Home  >  Article  >  Web Front-end  >  CSS float usage for operating DIV

CSS float usage for operating DIV

php中世界最好的语言
php中世界最好的语言Original
2017-11-21 18:05:362927browse

Css style float attribute is used to set the floating layout of label objects (such as:

label box, label, label, label and other html labels), Floating is what we call label objects floating to the left (float:left) and floating to the right (float:right).

What does float mean?

float means floating, and it also means floating when translated into Chinese. Go to the float manual in the corresponding css manual to learn about the basic information about float.

The role of float

Defining float (floating) through CSS allows the div style layer block to float to the left or right (lean).

float floating tutorial directory

float syntax

float application and usage

float floating case

css floating other applications

css floating summary

float syntax

Float is often followed by attribute values ​​​​left, right, none

Float:none does not use float

Float: left Float to the left

Float:right Float to the right

float syntax:

float : none | left |right

Parameter value:

none : The object does not float

left : The object floats on the left

right : The object floats on the right

Next, let’s explain float through a div+css example skills.

float application and usage

Float float is used to set the left and right floating styles of objects. It can achieve what we need to make DIV, SPAN and other labels float left and right.

Simple usage syntax

div{float:left} /* css comment: Set the div object to float to the left (left) */

div{float:right} / * css comment: Set the div object to float to the right (right) */

css float case

We set up two boxes in a box, one floating on the right and one floating on the left. To intuitively see the CSS floating layout effect, we set a certain width, height and border for the two boxes.

1. Main html code snippet:

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