Tailwind CSS Float

Class này chấp nhận nhiều hơn một giá trị trong tailwind CSS. Nó là một lựa chọn thay thế choCSS float property. Class float định nghĩa luồng nội dung để kiểm soát việc bao bọc nội dung xung quanh một phần tử.

Float Classes

  • float-right
  • float-left
  • float-none

float-right Class

Class này được sử dụng để làm cho phần tử nổi ở phía bên phải của container.

Syntax:

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

Example:

HTML
<!DOCTYPE html>
<html>

<head>
    <link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" 
        rel="stylesheet">
</head>

<body class="text-center">
    <h1 class="text-green-600 text-5xl font-bold">
        GeeksforGeeks
    </h1>

    <b>Tailwind CSS float Class</b>

    <div class="mx-10">
        <img class="float-right p-2" src=
    "https://media.geeksforgeeks.org/wp-content/uploads/20190807114330/GFG115.png">
    
        <p class="text-justify">
            How many times were you frustrated while looking out
            for a good collection of programming/algorithm/interview
            questions? What did you expect and what did you get?
            This portal has been created to provide well written,
            well thought and well explained solutions for selected
            questions. An IIT Roorkee alumnus and founder of
            GeeksforGeeks. He loves to solve programming problems
            in most efficient ways. Apart from GeeksforGeeks, he
            has worked with DE Shaw and Co. as a software developer
            and JIIT Noida as an assistant professor.It is a good
            platform to learn programming. It is an educational
            website. Prepare for the Recruitment drive of product
            based companies like Microsoft, Amazon, Adobe etc with
            a free online placement preparation course.
        </p>
    </div>
</body>

</html>

Output:

tailwind-css-float

float-left Class

Class này được sử dụng để làm cho phần tử nổi ở phía bên trái của container.

Syntax:

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

Example:

HTML
<!DOCTYPE html>
<html>
<head>
    <link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" 
        rel="stylesheet">
</head>

<body class="text-center">
    <h1 class="text-green-600 text-5xl font-bold">
        GeeksforGeeks
    </h1>

    <b>Tailwind CSS float Class</b>
    
    <div class="mx-10">
        <img class="float-left p-2" src=
    "https://media.geeksforgeeks.org/wp-content/uploads/20190807114330/GFG115.png">
        <p class="text-justify">
            How many times were you frustrated while looking out
            for a good collection of programming/algorithm/interview
            questions? What did you expect and what did you get?
            This portal has been created to provide well written,
            well thought and well explained solutions for selected
            questions. An IIT Roorkee alumnus and founder of
            GeeksforGeeks. He loves to solve programming problems
            in most efficient ways. Apart from GeeksforGeeks, he
            has worked with DE Shaw and Co. as a software developer
            and JIIT Noida as an assistant professor.It is a good
            platform to learn programming. It is an educational
            website. Prepare for the Recruitment drive of product
            based companies like Microsoft, Amazon, Adobe etc with
            a free online placement preparation course.
        </p>
    </div>
</body>

</html>

Output:

tailwind-css-float

float-none Class

Class này được sử dụng để làm cho phần tử nổi ở vị trí mặc định. Chúng ta đang dùng thẻ center để ảnh ở giữa.

Syntax:

<element class="float-none">...</element>

Example:

HTML
<!DOCTYPE html>
<html>
  
<head>
    <link href=
"https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css" 
        rel="stylesheet">
</head>

<body class="text-center">
    <h1 class="text-green-600 text-5xl font-bold">
        GeeksforGeeks
    </h1>

    <b>Tailwind CSS float Class</b>
    
    <div class="mx-10">
        <img class="float-none p-2 m-auto" src=
"https://media.geeksforgeeks.org/wp-content/uploads/20190807114330/GFG115.png">
        <p class="text-justify">
            How many times were you frustrated while looking out
            for a good collection of programming/algorithm/interview
            questions? What did you expect and what did you get?
            This portal has been created to provide well written,
            well thought and well explained solutions for selected
            questions. An IIT Roorkee alumnus and founder of
            GeeksforGeeks. He loves to solve programming problems
            in most efficient ways. Apart from GeeksforGeeks, he
            has worked with DE Shaw and Co. as a software developer
            and JIIT Noida as an assistant professor.It is a good
            platform to learn programming. It is an educational
            website. Prepare for the Recruitment drive of product
            based companies like Microsoft, Amazon, Adobe etc with
            a free online placement preparation course.
        </p>
    </div>
</body>

</html>

Output:

tailwind-css-float
Last Updated : 20/07/2025