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 the float of css to achieve the effect of wrapping text around pictures

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the knowledge of "how to use css's float to achieve the effect of text around pictures". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Css Foundation-float float

Float achieves the effect of text wrapping around images:

Float body {font-family: 'Microsoft Acer';} .per {width: 400px; border: 1px solid # CCC; padding: 5px;} .red {width: 100px; height: 100px; background: red; margin: 10px Float:left;} cascading style sheet (English full name: Cascading Style Sheets) is a computer language used to represent file styles such as HTML (an application of standard general markup language) or XML (a subset of standard general markup language). CSS can not only modify the web page statically, but also format the elements of the web page dynamically with various scripting languages. [1] CSS can accurately control the layout of elements in a web page at the pixel level, support almost all font size styles, and have the ability to edit web page objects and model styles.

Method 1 to clear floats:

Use an empty element after the floating element

Float .container {width:500px; border:1px solid # 000;} .div {width: 100px; height:100px; float:left;} .div1 {background-color:red;} .div2 {background-color:yellow } .div3 {background-color:green;} .clear {clear:both;}

Method 2 to clear floats:

Add overflow:hidden to the container

Float .container {width:500px; border:1px solid # 000; overflow: hidden;} .div {width: 100px; height:100px; float:left;} .div1 {background-color:red } .div2 {background-color:yellow;} .div3 {background-color:green;}

Method 3 to clear floats:

Css3: after pseudo element

Float .container {width:500px; border:1px solid # 000; overflow: hidden; zoom:1;} .div {width: 100px; height:100px; float:left;} .div1 {background-color:red } .div2 {background-color:yellow;} .div3 {background-color:green;} .clearfix: after {content:'.'; display: block; height:0; visibility: hidden; clear:both } .clearfix {zoom:1;/* compatible ie6/7*/} "how to use css's float to achieve text wrapping picture effect" is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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