What is the difference between a div floating layer and a div layer in CSS?

Source: Internet
Author: User

What is the difference between a div floating layer and a div layer in CSS?

First, the Div floating layer and div layer are the div layout, the body sense music generally uses the CSS style sheet and the div tag combination to layout the webpage.

div layer generally includes div floating layer, div floating layer Description div is added CSS floating style so called Div floating layer, and not joined float floating style does not have floating effect, so if not added floating style div is not called floating layer. Of course, span, H1, UL, Li and other labels are also layers, but span, H1, UL, Li and other tags do not have a high frequency div, so generally will be the div as a symbolic salutation.

Next DIVCSS5 through an example to tell you what is the general layer, what is a floating layer? Why use a div CSS floating layer.

1, complete DIV+CSS instance HTML code as follows body sense Music relaxation chair

<! DOCTYPE html>
<meta charset= "Utf-8"/>
<title>div layer and floating layer </title>
<style>
. divcss5{width:400px; height:100px}
. divcss5-a{Float:left; border:1px solid #F00; width:100px; height:80px}
. divcss5-b{float:right; border:1px solid #00F; width:100px; height:80px}
</style> Body Music Relaxation chair
<body>
<div class= "DIVCSS5" >
<div class= "Divcss5-a" ></div>
<div class= "Divcss5-b" ></div>
</div>
</body>

The object ". Divcss5" is not set to float, ". Divcss5-a" is set to float on the left (Float:left), ". Divcss5-b" is set to float on the right (Float:right).

2. Example of normal layer and floating layer

Common layer and floating layer CSS case
Common layer and floating layer CSS case

3. Layer and floating layer summary body sense Music relaxation chair
In the above example, the ". Divcss5" object is a normal layer, and the default is a layer that does not have a floating effect, because the content of the page is left, so to see this layer left, there is actually no floating style of a div box layer. The ". Divcss5-a" and ". Divcss5-b" of the object are set to float so that they become floating layers, which can be seen in the ". Divcss5" box. A floating one on the left floats on the right. The difference between a normal layer and a floating layer is whether the CSS float style is set.

4. Why floating styles are set
This is because you want the div object box to be left-or-right-layout.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.