×

Tailwind CSS Top / Right / Bottom / Left

In tailwind CSS, these classes take a variety of values and cover all of the characteristics in the class form. These are the CSS Top/Right/Bottom/Left properties' replacements. These classes are used to determine how a positioned element is aligned. Remember that these properties can only be applied to positioned elements.

Top/Right/Bottom/Left classes

The various types of Top/Right/Bottom/Left classes are listed below:

  • .inset-0
  • .inset-y-0
  • .inset-x-0
  • .top-0
  • .right-0
  • .bottom-0
  • .left-0
    • In Tailwind, the top/right/bottom/left/inset utilities have default values of 0 and auto.
    • You can replace "0" with any of the allowed "rem" values.

inset-0

It's used to provide the top/right/bottom/left properties of an element a 0px value.

Syntax:

<element class="inset-0">...</element>

Example:

<!DOCTYPE html>
<html>
<head>
<link href=
"https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" 
rel="stylesheet">
</head>
<body>
<div class="text-red-600 font-bold m-4">
<h1 class="text-3xl my-4" > Tutorial and Example</h1>
<p class=" text-2xl">Tailwind CSS Top/Right/Bottom/Left</p>


</div>
<div class="relative h-24 w-24 bg-red-400 m-4">
<div class="absolute inset-0 bg-red-800"></div>
</div>
</body>
</html>

Output:

Tailwind CSS Top Right Bottom Left

inset-y-0

It's used to give the element's top and bottom properties a value of 0px.

Syntax:

<element class="inset-y-0">...</element>

Example:

<!DOCTYPE html>
<html>
<head>
<link href=
"https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" 
rel="stylesheet">
</head>
<body>
<div class="text-red-600 font-bold m-4">
<h1 class="text-3xl my-4" > Tutorial and Example</h1>
<p class=" text-2xl">Tailwind CSS Top/Right/Bottom/Left</p>


</div>
<div class="relative h-28 w-28 bg-red-400 m-4">
<div class="absolute inset-y-0 
w-16 bg-red-800">
</div>
</div>
</body>
</html>

Output:

Tailwind CSS Top Right Bottom Left

inset-x-0

It's used to give the element's right and left properties a value of 0px.

Syntax:

<element class="inset-x-0">...</element>

Example:

<!DOCTYPE html>
<html>
<head>
<link href=
"https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" 
rel="stylesheet">
</head>
<body>
<div class="text-red-600 font-bold m-4">
<h1 class="text-3xl my-4" > Tutorial and Example</h1>
<p class=" text-2xl">Tailwind CSS Top/Right/Bottom/Left</p>


</div>
<div class="relative h-28 w-28 bg-red-400 m-4">
<div class="absolute inset-x-0 
h-9 bg-red-800">
</div>
</div>
</body>
</html>

Output:

Tailwind CSS Top Right Bottom Left

top-0

It's used to give the element's top property the value 0px.

Syntax:

<element class="top-0">...</element> 

left-0

It's used to give the element's left property the value 0px.

Syntax:

<element class="left-0">...</element>

The left-0 and top-0 classes are used in this example.

Example:

<!DOCTYPE html>
<html>
<head>
<link href=
"https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" 
rel="stylesheet">
</head>
<body>
<div class="text-red-600 font-bold m-4">
<h1 class="text-3xl my-4" > Tutorial and Example </h1>
<p class=" text-2xl">Tailwind CSS Top/Right/Bottom/Left</p>


</div>
<div class="relative h-36 w-36 bg-red-400 m-4">
<div class="absolute left-0 top-0 
w-16 h-16 bg-red-800">
</div>
</div>
</body>
</html>

Output:

Tailwind CSS Top Right Bottom Left

right-0

It's used to give the element's right property the value 0px.

Syntax:

<element class="right-0">...</element> 

bottom-0

It's used to give the element's bottom property the value 0px.

Syntax:

<element class="bottom-0">...</element> 

The right-0 and bottom-0 classes are used in this example.

Example:

<!DOCTYPE html>
<html>
<head>
<link href=
"https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" 
rel="stylesheet">
</head>
<body>
<div class="text-red-600 font-bold m-4">
<h1 class="text-3xl my-4" >Tutorial and Example</h1>
<p class=" text-2xl">Tailwind CSS Top/Right/Bottom/Left</p>


</div>
<div class="relative h-36 w-36 bg-red-400 m-4">
<div class="absolute right-0 bottom-0 
w-16 h-16 bg-red-800">
</div>
</div>
</body>
</html>

Output:

Tailwind CSS Top Right Bottom Left

Related Topics

Tailwind CSS Align Content

In Tailwind CSS, this class accepts a wide range of values. It's a replacement for the CSS Align Content feature. This class is used to modify the flex-wrap property's behavior....

5 minutes read.

Tailwind CSS Height

This class accepts a large number of values, and all of the properties are covered in class form. It's a replacement for the CSS height property. This class is used...

4 minutes read.

Tailwind CSS Order

One of the best features of Tailwind CSS is the Order class, which allows us to order flex and grid objects according to our needs. There are several different order...

2 minutes read.

Tailwind CSS Box Shadow

The Tailwind CSS Box Shadow class accepts a lot of value, and all of the properties are covered in class form. We may control the box-shadow of an element by...

2 minutes read.

Tailwind CSS Flex Direction

CSS flexbox is an important element for frontend development. CSS has four directions, therefore in tailwind CSS, all of the properties are covered in class form. It's a front-end development...

5 minutes read.

Tailwind CSS Box Sizing

Tailwind CSS Box sizing class acknowledges more than one worth in tailwind CSS. Each property is shrouded as a class structure. It is an option in contrast to the CSS...

2 minutes read.

Tailwind CSS Grid Auto Columns

The Grid Auto Columns class accepts multiple values, and all of the properties are covered in class form. It's a replacement for the CSS grid-auto-columns property. The size of the...

5 minutes read.

Tailwind CSS Position

The position class acknowledges more than one value in tailwind CSS. It is an option in contrast to the CSS Position property. This class is utilized for controlling how an...

5 minutes read.

Tailwind CSS Stroke Width

In tailwind CSS, this class takes a large number of values and all of the properties are covered in the form. It is used to specify the width of an...

1 minute read.

Tailwind CSS Object Fit

It acknowledges more than one value in tailwind CSS. Every one of its properties is covered as in class form. It is the option in contrast to the CSS object-fit...

4 minutes read.

Tailwind CSS Place Items

This class accepts a wide range of values. It's a replacement for the CSS Place Items property. This class is used to manage how things are justified while still being...

4 minutes read.

Tailwind CSS Installation

Here, we will discuss the installation method of Tailwind CSS using two strategies discussed as follows: Strategy 1: Install Tailwind through npm Step 1: npm init - y Step 2: npm install tailwindcss Step...

2 minutes read.

Tailwind CSS Flex Grow

CSS flexbox is an important element for frontend development; there are two flex-grow options in Tailwind CSS, and all attributes are covered in class form. It is an alternative to...

3 minutes read.

Tailwind CSS Stroke

This class accepts a lot of value, and all of the properties are covered in class form. It's the stroke class that goes on top of the SVG element. Stroke...

2 minutes read.

Tailwind CSS Clear

This class acknowledges more than one worth in tailwind CSS. Every one of the properties is canvassed as in class form. It is an option in contrast to the CSS...

5 minutes read.

Tailwind CSS Visibility

In tailwind CSS, this class accepts two values. It's a replacement for the CSS visibility property. This class specifies whether an element in a web document is visible or not,...

2 minutes read.

Tailwind CSS Place Self

The tailwind CSS Place self class accepts a wide range of values. It's a replacement for the CSS Place Items property. This class is used to manage how a single...

4 minutes read.

Tailwind CSS Flex Wrap

CSS flexbox is an important component for frontend development. It is a front-end development alternative to the CSS flex-wrap Property. Note: You must include the flex class in your element before...

4 minutes read.

Tailwind CSS Justify Self

The class form goes over the various properties. It's a replacement for the CSS justify-self attribute. This class is used to describe the alignment of content’s position in a CSS...

4 minutes read.

Tailwind CSS Grid Auto Flow

In tailwind CSS, this class accepts multiple values, and all of the properties are covered in class form. It is a CSS alternative. The grid-auto-flow property is used in Tailwind...

4 minutes read.