Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 21, 2022 03:43 pm GMT

Tailwind CSS tutorial 19: Font Weight

In the article, we will go into detail on how to use font-weight.

Font Weight

Format

font-{weight}

AlignmentTailwind ClassCSS Property
font-thinfont-thinfont-weight: 100;
font-extralightfont-extralightfont-weight: 200;
font-lightfont-lightfont-weight: 300;
font-normalfont-normalfont-weight: 400;
font-mediumfont-mediumfont-weight: 500;
font-semiboldfont-semiboldfont-weight: 600;
font-boldfont-boldfont-weight: 700;
Font-extraboldfont-extraboldfont-weight: 800;
Font-blackfont-boldfont-weight: 900;

Setting the font weight

Control the font weight of an element using the font-{weight} utilities.

Code

<ul class="container mx-auto leading-none divide-y divide-gray-400 divide-dotted" style="font-family: Raleway">  <li class="flex items-center justify-between px-4 py-2">    <div>      <div class="font-light text-5xl align-middle mb-2">Hello World</div>    </div>    <div class="text-xs font-semibold font-mono whitespace-nowrap px-2 py-1 ml-5 rounded text-white bg-pink-500 rounded-2">font-light   </div>  </li>  <li class="flex items-center justify-between px-4 py-2">    <div>      <div class="font-normal text-5xl align-middle mb-2">Hello World</div>    </div>    <div class="text-xs font-semibold font-mono whitespace-nowrap px-2 py-1 ml-5 rounded text-white bg-pink-500 rounded-2">font-normal  </div>  </li>  <li class="flex items-center justify-between px-4 py-2">    <div>      <div class="font-medium text-5xl align-middle mb-2">Hello World</div>    </div>    <div class="text-xs font-semibold font-mono whitespace-nowrap px-2 py-1 ml-5 rounded text-white bg-pink-500 rounded-2">font-medium  </div>  </li>  <li class="flex items-center justify-between px-4 py-2">    <div>      <div class="font-semibold text-5xl align-middle mb-2">Hello World</div>    </div>    <div class="text-xs font-semibold font-mono whitespace-nowrap px-2 py-1 ml-5 rounded text-white bg-pink-500 rounded-2">font-semibold</div>  </li>  <li class="flex items-center justify-between px-4 py-2">    <div>      <div class="font-bold text-5xl align-middle mb-2">Hello World</div>    </div>    <div class="text-xs font-semibold font-mono whitespace-nowrap px-2 py-1 ml-5 rounded text-white bg-pink-500 rounded-2">font-bold    </div>  </li></ul>

Full code:
The overall code will be attached to repo link.

Overall Output
Image description

Resources:
tailwind.css

Thank you for reading :), To learn more, check out my blogs on Flex Direction, Hackathons and Flex Wrap.
If you liked this article, consider following me on Dev.to for my latest publications. You can reach me on Twitter.

Keep learning! Keep coding!!


Original Link: https://dev.to/shubhicodes/tailwind-css-tutorial-19-font-weight-2kak

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To