Open In App

Tachyons Layout Widths

Tachyons Layout Widths are used to provide width to the element and the width of an element does not include padding, borders, or margins. This width module holds a five-step width scale on powers of two and a percentage series of values. 

Syntax:



<element-tag class= "Width-class">
    ...
</element-tag>

Tachyons Layout Widths Classes: 

Below examples illustrate the Tachyons Layout Widths:



Example 1: In the below example we will use the width scale classes.




<!DOCTYPE html>
<html lang="en">
  <head>
    <meta name="viewport" 
          content="width=device-width, initial-scale=1" />
    <link
      rel="stylesheet"
      href=
  </head>
  
  <body>
    <h2 class="tc green">GeeksforGeeks</h2>
    <h3 class="tc">
      Tachyons Layout Widths
    </h3>
    <h1 class="w1 ba tc bw1">GFG</h1>
    <h1 class="w2 ba tc bw1">GFG</h1>
    <h1 class="w3 ba tc bw1">GFG</h1>
    <h1 class="w4 ba tc bw1">GFG</h1>
    <h1 class="w5 ba tc bw1">GFG</h1>
  </body>
</html>

Output:

 

Example 2: In this example we will use the percentage classes.




<!DOCTYPE html>
<html lang="en">
  <head>
    <title>GFG</title>
    <meta name="viewport" 
          content="width=device-width, initial-scale=1" />
    <link
      rel="stylesheet"
      href=
  </head>
  
  <body>
    <h2 class="tc green">GeeksforGeeks</h2>
    <h3 class="tc">
      Tachyons Layout Widths
    </h3>
    <h1 class="w-20 ba tc bw1">GFG</h1>
    <h1 class="w-30 ba tc bw1">GFG</h1>
    <h1 class="w-third ba tc bw1">GFG</h1>
    <h1 class="w-40 ba tc bw1">GFG</h1>
    <h1 class="w-50 ba tc bw1">GFG</h1>
  </body>
</html>

Output:

 

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


Article Tags :