In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces CSS how to achieve a single DIV adaptive width layout related knowledge, the content is detailed and easy to understand, the operation is simple and fast, has a certain reference value, I believe that everyone after reading this CSS how to achieve a single DIV adaptive width layout article will have a harvest, let's take a look.
CSS5 first gives everyone a brief introduction to the self-adaptive width of a column, which is also equal to the width of a row that adapts to the DIV. Through the DIV CSS instance CSS adaptive width structure, and then the common uses to introduce the structure means that fully dominate the adaptive exclusive row and column.
Key point: self-adaptation, at this time can not use the static CSS width value, this time can only use the percentage width to interpret the width.
Hub code: the percentage value of width:?% in percentage, and the artificial object will actively calculate the width of the object according to the set percentage.
Example CSS code:
.box {width:60%; height:80px; border:1px solid # F00; margin:0 auto}
Note: here the width of the equipment is set to 60%, in order to check the achievements, so the configuration height and red border are given, because thinking about independently setting a DIV box as normal center, so set margin:0 auto
Broken HTML source code (including HTML and CSS):
Independent of a width adaptive instance. Box {width:60%; height:80px; border:1px solid # F00; margin:0 auto} mode
Screenshot of the effectiveness of the example:
The above is an example of self-adaptive width breakage.
The extended thinking of CSS5 is clear:
1. In the usual web layout, as usual, the main form is the static width, so the specific setting of the equipment width can be definitely obtained according to the art drawing, but occasionally it is not possible to set the equipment static width format when the width is adaptive.
2. In some DIV CSS organizations, because the outermost layer is configured with a detailed width, and the children who walk alone do not need to set the equipment width style unintentionally, how tacitly it allows that the DIV width is equal to 100%, if an object sets the equipment width to rest. Instead of setting the width, the subset sets paddding-left or padding-right (about both are equipped). At this time, the dabbler explains that rendering the subset DIV width will still be particularly smart to subtract the padding occupancy width by the total width. Usually when constructing a small part of the environment, a single row of DIV can only use no floats or do not have to set the detailed width or percentage width, because the browser will intelligently deal with the penalty width according to the parent of this layer.
This is the end of the article on "how CSS implements the adaptive width layout of DIV alone". Thank you for reading! I believe that everyone has a certain understanding of the knowledge of "CSS how to achieve DIV adaptive width layout". If you want to learn more, you are welcome to follow 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.