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

The method of DIV CSS layout of upper, middle and lower structure

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

Share

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

This article mainly explains the "upper, middle and lower structure DIV CSS layout method", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's train of thought slowly in depth, together to study and learn "upper, middle and lower structure DIV CSS layout method" bar!

I. main ideas

Regardless of a number of high and low structures or a single structure, usually the main form is usually in the middle, this application needs to use the css margin format (to make the construction center compatible with the major hunters), and usually the web page will rest in width, which is equivalent to using css width to set up the width of each DIV layer.

Here, the three DIV boxes with upper, middle and lower structures are actually at the same level, and the three DIV layers from top to bottom are only in the middle.

Second, organizational case thinking

1. The layout should be based on the techniques.

Margin:0 auto: CSS layout is centered and subordinate.

Width configuration width

The border frame name is in this case to facilitate observation and participate in the CSS pattern, and the practical project layout increases or decreases according to the demand.

The height configuration height is also the height style set by each DIV layer in this case, just like the ordinary structure does not require the configuration height, because usually the configuration assumption form cannot be determined not to set the height.

2. Specific skill value

Margin:0 auto (DIV central disobedience)

Width:400px (set width to 400px)

Border:1px solid # F00; border:1px solid # FF0; border:1px solid # 00F (set 3 borders that are red, yellow and blue)

Height:100px;height:200px;height:100px configures three CSS height values

Third, the incomplete code of the example

CSS5 completes case testing or building, as usual, initialization templates are basically done, so as not to copy different readers with poor compatibility. Here the CSS5 supply CSS5 initialization template continues on the basis.

The upper middle and lower name separation is header, content, footer, because of the structural organization, so it is necessary to develop a usually large structure to use id, so CSS chose the logo label as "#" when naming.

1. The case corresponds to the CSS code

# header,#content,#footer {margin:0 auto;width:400px; height:100px} / * the above code sets three common equipment styles * / # header {border:1px solid # F00} # content {border:1px solid # FF0; height:200px} # footer {border:1px solid # 00F}

Code clarification: the first row of the above CSS code, on behalf of the three common center, width, height style, negative three separate settings (header) red border, middle (content) yellow frame, bottom (footer) blue frame.

2. The case corresponds to the HTML code

3. Screenshot of the final result

4. Broken HTML code

Online demonstration of upper, middle and lower structure CSS5

5. Incomplete CSS code

@ charset "utf-8"; body, div {margin:0; padding:0;font-style: normal; font:12px/22px "\ 5B8B\ 4F53", Arial, Helvetica, sans-serif} body {color:#000000;bac kg round:#FFF; text-align:center} a {color:#000000;text-decoration:none} a:hover {color:#BA2636;text-decoration:underline} # header,#content,#footer {margin:0 auto;width:400px Height:100px} / * the above code configures three common tricks * / # header {border:1px solid # F00} # content {border:1px solid # FF0 Height:200px} # footer {border:1px solid # 00F} Thank you for your reading. The above is the content of "the method of upper, middle and lower structure DIV CSS layout". After the study of this article, I believe you have a deeper understanding of the method of upper, middle and lower structure DIV CSS layout, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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