Open In App

Tailwind CSS Line Height

This class accepts lots of value in tailwind CSS  in which all the properties are covered as in class form. It is the alternative to the CSS Line Height property. This class is used to set the amount of space used for lines, such as in the text. Negative values are not allowed.

Line Height classes:



Syntax:

<element class="leading-{height}">...</element>

Example: In this example, we will use three classes leading-none, leading-normal and leading-loose. You can change the class name according to your need.






<!DOCTYPE html>
  
<head>
    <link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css"
        rel="stylesheet">
</head>
  
<body class="text-center mx-4 space-y-2">
    <h1 class="text-green-600 text-5xl font-bold">
        GeeksforGeeks
    </h1>
  
    <b>Tailwind CSS Line Height Class</b>
      
    <div class="mx-24 bg-green-200 text-justify">
        <p class="p-2">leading-none:<br>
            <span class="leading-none">
                How many times were you frustrated 
                while looking out for a good 
                collection of programming/algorithm
                /interview questions? What did you 
                expect and what did you get?
                GeeksforGeeks.
            </span>
        </p>
  
        <p class="p-2">leading-normal:<br>
            <span class="leading-normal">
                How many times were you frustrated 
                while looking out for a good 
                collection of programming/algorithm
                /interview questions? What did you 
                expect and what did you get?
                GeeksforGeeks.
            </span>
        </p>
  
        <p class="p-2">leading-loose:<br>
            <span class="leading-loose">
                How many times were you frustrated 
                while looking out for a good 
                collection of programming/algorithm
                /interview questions? What did you 
                expect and what did you get?
                GeeksforGeeks.
            </span>
        </p>
    </div>
</body>
  
</html>

Output:

Line height classes


Article Tags :