Home  >  Article  >  Web Front-end  >  How to solve the css float misalignment problem

How to solve the css float misalignment problem

藏色散人
藏色散人Original
2020-12-15 15:05:012992browse

Solution to css float misalignment: 1. When two elements of the same level are misaligned, add an empty label between the two elements; 2. Set the CSS attribute to ".clear{clear:both ;}" That's it.

How to solve the css float misalignment problem

The operating environment of this tutorial: windows7 system, css3 version, thinkpad t480 computer.

Recommended: "css video tutorial"

Solution to misalignment of elements caused by using float attribute

If two of the same level If the elements are misaligned, add an empty tag between the two elements, such as:

<div class="clear"></div>

and then set the CSS attribute:

.clear{
clear:both;
}

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

Statement:
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
Previous article:Why use css stylesheetsNext article:Why use css stylesheets