Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use css floating float

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article is to share with you about how to use css floating float. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

I. float grammatical structure and small examples

1. Float syntax:

Float: none | left | right

2. Introduction of float parameter values:

Float:none-objects do not float

Float:left-the object floats on the left

Float:right-the object floats on the right

3. Instructions for using float values:

The value of the float property indicates whether and how the object floats.

When this attribute is not equal to none and causes the object to float, the object is treated as a block object (block-level), that is, the display attribute equals block. That is, the display property of the floating object is ignored.

4. Css float structure analysis diagram

Float attribute analysis diagram

5. Small example of float configuration:

. exp-a {float: left}

. exp-b {float: right}

Float sets objects to the left (float:left) and right (float:right), which is very important in div css layout.

2. Small instance of float

Here CSS5 uses float to set two boxes, one on the left and the other on the right. In order to observe the effect of floating objects on the left and right, set the css width, CSS height and CSS frame respectively.

1. Complete HTML CSS code

Float attribute small instance CSS5

.exp {width:500px; border:1px solid # 333; padding:10px; overflow:hidden}

. exp-a {float:left; width:200px; height:100px; border:1px solid # F00}

. exp-b {float:right; width:260px; height:120px; border:1px solid # 00F}

Float instance CSS code explanation:

.exp {width:500px; border:1px solid # 333; padding:10px; overflow:hidden}

In order to observe the effect of the child float floating the small DIV object on the left and right in the .exp object, set a black border and 500px padding width to prevent the internal child from getting close to the parent DIV. Because the child in the .exp sets float, set overflow:hidden to let the .exp open.

Thank you for reading! This is the end of this article on "how to use css floating float". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report