In Tailwind CSS, text-xl corresponds to 1.25rem and text-2xl corresponds to 1.5rem by default. Option D (text-xl md:text-2xl) correctly applies 1.25rem on small screens and 1.5rem on medium screens and larger. (Note: Tailwind's default sizes can be customized, but this is the standard scale.)
class="text-base lg:text-lg text-xl"The original class string has conflicting font sizes: text-xl overrides the base size. The correct fix is to remove the conflicting text-xl so the font size is 1rem on mobile (text-base) and 1.25rem on large screens (lg:text-xl).
<p class="text-sm md:text-lg lg:text-xl">Hello</p>
What font size will the text "Hello" have on a medium screen (width between 768px and 1023px)?
<p class="text-sm md:text-lg lg:text-xl">Hello</p>On medium screens, the md:text-lg class applies. Tailwind's text-lg is 1.125rem (18px). So the text will be 18px on medium screens.
Tailwind's default 'lg' breakpoint starts at 1024px. So lg:text-xl applies font size 1.25rem (text-xl) only on screens wider than 1024px.
Using relative font sizes with responsive classes allows the text to scale properly on different screen sizes. Respecting user browser settings for font scaling ensures accessibility for users with visual impairments or preferences. Fixed sizes or inline pixel values can break accessibility.