Home  >  Article  >  Web Front-end  >  Detailed explanation of CSS floating property Float? The most complete detailed explanation of Float in history

Detailed explanation of CSS floating property Float? The most complete detailed explanation of Float in history

云罗郡主
云罗郡主Original
2018-10-19 11:36:193890browse

When we learn CSS styles, we all know that CSS is a box concept, and each box is an element. Below we will explain in detail the CSS floating attribute Float so that you can fully understand Float.

Detailed explanation of CSS floating property Float? The most complete detailed explanation of Float in history

1: What is Float?

Float is a positioning attribute in css. We know that text can be arranged around pictures. In typesetting software, we can treat square text boxes as pictures and arrange them. We don’t care about where pictures appear. Which location.

In web design, we can use floating elements in CSS. The code is as follows:

sidebar { float: right; }

The float attribute has four available values. Right and left refer to the direction of floating respectively. , if you do not want to float, use None to indicate it. Float can also be used for small layouts. If we want to float the small avatar, when we adjust the image size, we find that the text of the box will also change. We need to use Jedi positioning in the avatar to keep it unchanged. , the text will not change as the picture changes.

2: How to clear float

Clear float is the opposite property of float. As long as we set clear float, there will be no floating effect, thus floating upward to On the contrary, the boundary of the element may float downward. The code to clear the float is as follows:

#footer { clear: both; }

The above is a detailed explanation of the CSS floating property Float? The most comprehensive introduction to Float in history. If you want to know more about CSS video tutorial, please pay attention to the php Chinese website.


The above is the detailed content of Detailed explanation of CSS floating property Float? The most complete detailed explanation of Float in history. 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