Open In App

Tachyons Theming Background Size

Tachyons is a toolkit that is used to create a responsive website. In this article, we will learn how to change the size of the background using the Tachyons toolkit. 

Tachyons Theming Background Size is used to fill the containing elements with the background image. We can use contain and cover classes to fill the background image.



Tachyons Theming Background Size Classes:

Syntax: 



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

Example 1: This example demonstrates the Tachyons Theming Background Size using contain class.




<!DOCTYPE html>
<html>
 
<head>
    <title>GFG</title>
    <link rel="stylesheet" href=
 
    <style>
        body {
            text-align: center;
            margin: 20px;
            background-image: url(
            background-repeat: no-repeat;
        }
    </style>
</head>
 
<body class="contain">
    <h1 class="green">GeeksforGeeks</h1>
</body>
 
</html>

Output:

 

Example 2: This example demonstrates the Tachyons Theming Background Size using cover class.




<!DOCTYPE html>
<html>
 
<head>
    <title>GFG</title>
    <link rel="stylesheet" href=
 
    <style>
        body {
            text-align: center;
            margin: 20px;
            background-image: url(
            background-repeat: no-repeat;
        }
    </style>
</head>
 
<body class="cover">
    <h1 class="green">GeeksforGeeks</h1>
</body>
 
</html>

Output:

 

Reference: https://tachyons.io/docs/themes/background-size/


Article Tags :