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 does the span width of css take effect?

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

Share

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

Today, the editor will share with you the relevant knowledge points about how to set the span width of css to take effect. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look.

Css setting equipment span width is invalid, let span set equipment equipment width (width color) effective layout capacity

Span itself is not a block (like no bone) tag element, unlike the div tag to directly configure the width width can be invalid, while the span direct configuration width width style will not take effect.

Span success setting width method:

1. Set up equipment and float for span

Set up float floating style for span equipment according to demand, and then set width width to be effective. The width of the virus float works, but it is necessary to apply the float floating format at the same level, otherwise there will be an overlap between the floating box and the non-floating box.

Span sets up equipment and equipment float to achieve width works

Float completes span width span {float:left;width:300px; border:1px solid # F00} I constitute a block outside the width configuration 300pxspan

Css span sets float to achieve success in setting equipment width style screenshot of an example

2. Configure display:block for span

Display:block allows span to form block elements and become abnormal default blocks like DIV. The error is different from that of DIV.

Sample complete source code (HTML+CSS example code):

Display:block completes span width span {display:block; width:300px} I made a block width configuration 300px I want to be flashed by line feeds

Screenshot of the attainments of span width setting equipment installation

3. Summary of span width setting expanded to span height agility

In its own acquiescence environment, setting equipment width and configuration height for span is effective and cannot be invalidated. In general, after setting float floating or display:block for span equipment, span setting equipment width and height can only be realized normally, so practice agencies choose to complete span width and height according to the needs.

These are all the contents of the article "how to set the span width of css to take effect". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

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