Open In App

Tachyons Layout Max Widths

Last Updated : 08 Jun, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

Tachyons is used to define the maximum width of the element. In simple words, if the content is larger than the maximum width, it will automatically change the height of the element.

Syntax:

<div class ="mw3">...</div>

Tachyons Layout Max Widths Class:

  • “mw” class: It is used to define the maximum width of the element.

Modifiers offered by Tachyons toolkit: This modifier is used to change the width scale between 1 to 9.

Media Query Extensions:

  • not-small(-ns): This media query extension is used to display content when the size of the screen is small.
  • medium(-m): This media query extension is used to display content when the size of the screen is medium.
  • large(-l): This media query extension is used to display content when the size of the screen is large.

Example 1: In the below example we will use the basic “mw” class.

HTML




<!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="mw3">GFG</div><br>
    <div class="mw4">GFG</div><br>
</body>
  
</html>


Output:

Tachyons Layout Max Widths

Example 2: In the below example we will use the basic “mw” class.

HTML




<!DOCTYPE html>
<html>
<head>    
    <link rel="stylesheet" href=
  
    <style>
        body{
            text-align:center;
        }
        h1{
            color:green;
              
        }
        div{
            border:2px solid black;
            background-color:lightgreen;
            margin-left:280px;
        }
    </style>
</head>
      
<body>
    <h1>GeeksforGeeks</h1>
    <h3>A computer science portal for geeks</h3><br>
    <h4>Programming Language</h4>
      
    <div class ="mw4">
      Programming Language is indeed the fundamental unit of today’s
      tech world. It is considered as the set of commands and instructions
      that we give to the machines to perform a particular task.
    </div>
    <br>
    <div class ="mw6">
      Programming Language is indeed the fundamental unit of today’s 
      tech world. It is considered as the set of commands and instructions
      that we give to the machines to perform a particular task. 
    </div>
</body>
</html>


Output:

Tachyons Layout Max Widths

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



Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads