Open In App

Tachyons Layout Spacing

Tachyons Layout Spacing is used to specify the space between elements. Your website will look good when you use spacing between the elements. Mainly there are two types of spacing:

Syntax:



<element-name class="class-name">...</element-name>

Tachyons Layout Spacing Classes:

From all sides:



From top:

From bottom:

From Left:

From Right:

Horizontal spacing:

Vertical spacing:

Example 1: In the below example we have used the “pa” class that will create padding from all sides.




<!DOCTYPE html>
<html>
 
<head>
    <link rel="stylesheet"
          href=
 
    <style>
        body {
            text-align: center;
        }
 
        h1 {
            color: green;
 
        }
 
        div {
            border: 2px solid black;
            background-color: lightgreen;
        }
    </style>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
    <h3>A computer science portal for geeks</h3>
 
    <div class="pa1">GFG</div><br>
    <div class="pa2">GFG</div><br>
    <div class="pa3">GFG</div><br>
    <div class="pa4">GFG</div><br>
    <div class="pa5">GFG</div><br>
    <div class="pa6">GFG</div><br>
</body>
 
</html>

Output:

 

Example 2: In the below example we have used the “ma” class that will create margin from all sides.




<!DOCTYPE html>
<html>
 
<head>
    <link rel="stylesheet"
          href=
 
    <style>
        body {
            text-align: center;
        }
 
        h1 {
            color: green;
 
        }
 
        div {
            border: 2px solid black;
            background-color: lightgreen;
        }
    </style>
</head>
 
<body>
    <h1>GeeksforGeeks</h1>
    <h3>A computer science portal for geeks</h3>
 
    <div class="ma1">GFG</div><br>
    <div class="ma2">GFG</div><br>
    <div class="ma3">GFG</div><br>
    <div class="ma4">GFG</div><br>
    <div class="ma5">GFG</div><br>
    <div class="ma6">GFG</div><br>
</body>
 
</html>

Output:

 

Reference: https://tachyons.io/docs/layout/spacing/


Article Tags :