How to close float in css

王林
Release: 2023-01-06 11:14:12
Original
3794 people have browsed it

The way to turn off floating in CSS is to add the clear attribute to the element and set the attribute value to none, such as [clear:both;]. The clear attribute specifies that no other floating elements are allowed on a certain side of the element.

How to close float in css

The operating environment of this article: windows10 system, css 3, thinkpad t480 computer.

There is an attribute clear in css, which specifies which side of the element does not allow other floating elements.

Commonly used attribute values are:

  • left Floating elements are not allowed on the left side.

  • #right No floating elements are allowed on the right side.

  • #both Floating elements are not allowed on the left and right sides.

  • #none Default value. Allows floated elements to appear on both sides.

  • #inherit Specifies that the value of the clear attribute should be inherited from the parent element.

A small example:

   
Copy after login

Related video sharing:css video tutorial

The above is the detailed content of How to close float in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!