An Interest In:
Web News this Week
- April 19, 2024
- April 18, 2024
- April 17, 2024
- April 16, 2024
- April 15, 2024
- April 14, 2024
- April 13, 2024
November 21, 2022 03:43 pm GMT
Original Link: https://dev.to/shubhicodes/tailwind-css-tutorial-19-font-weight-2kak
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}
Alignment | Tailwind Class | CSS Property |
---|---|---|
font-thin | font-thin | font-weight: 100; |
font-extralight | font-extralight | font-weight: 200; |
font-light | font-light | font-weight: 300; |
font-normal | font-normal | font-weight: 400; |
font-medium | font-medium | font-weight: 500; |
font-semibold | font-semibold | font-weight: 600; |
font-bold | font-bold | font-weight: 700; |
Font-extrabold | font-extrabold | font-weight: 800; |
Font-black | font-bold | font-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.
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:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To