Home > Web Front-end > CSS Tutorial > How to write left floating css

How to write left floating css

anonymity
Release: 2019-05-28 10:19:21
Original
7659 people have browsed it

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).

How to write left floating css

#What does float mean?

float means floating, and it also means floating when translated into Chinese.

The role of float

Define float (float) through CSS to let the div style layer block float to the left or right (lean).

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

Float:none does not use float

Float:left floats to the left

Float:right Right float

float syntax:

float : none | left |right

Parameter value:

none : The object does not float

left : Object floats on the left

right : Object floats on the right

Case:

We set up a box, There are two boxes floating, one on the right and one on the left. In order 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:

<div class="divcss5"> 
    <div class="divcss5_left">布局靠左浮动</div> 
    <div class="divcss5_right">布局靠右浮动</div> 
    <div class="clear"></div><!-- html注释:清除float产生浮动 --> 
</div>
Copy after login
2、css代码片段:
.divcss5{ width:400px;padding:10px;border:1px solid #F00} 
.divcss5_left{ float:left;width:150px;border:1px solid #00F;height:50px} 
.divcss5_right{ float:right;width:150px;border:1px solid #00F;height:50px} 
.clear{ clear:both}
Copy after login

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

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template