In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is about how to use a fixed-width three-column layout in CSS. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
Fixed width three-column layout
This is very basic, and we can understand it by looking directly at the code:
Header aside
Main
Content-aside
Footer # header {width: 980px; height: 90px; margin: 0 auto; background: # f60;} # body {width: 980px; margin: 0 auto;} # aside {float: left; width: 240px; background: # ccc;} # content {margin-left: 240px;} # main {float: left; width: 540px; background: pink;} # content-aside {float: left; width: 200px; background: orange;} # footer {width: 980px; height: 90px; margin: 0 auto Background: # 08f;}
Example: realization of equal width and equal spacing layout of three-column pictures
Each picture block floats to the left, with a width of 30% and a left margin of 2.5%:
100% = (2.5% 30%) + (2.5% 30%) + (2.5% 30%) + 2.5%
Equal width layout of three-column images * {margin: 0; padding: 0;} img {display: block; width: 30%; margin: 2.5% 002.5%; float: left;}
Width: 30%; represents 30% of the width of the parent element.
Height: 30%; if the specific height of the parent element is not set, then the height has no effect.
To achieve a responsive square, you can use the unit vw (Viewport Width):
.square {width: 30%; height: 30vW; background: url ("byd.jpg") no-repeat scroll center 0 transparent; background-size: 100% 100%; margin: 2.5% 00 2.5%; float: left;}
It is important to note, however, that lower-version IE and lower-version Android/iOS browsers do not support viewport units.
Or use JS to set height according to width to ensure compatibility:
$(document) .ready (function () {$("img"). Height ($("img"). Width ();}); $(window) .resize (function () {$("img"). Height ($("img"). Width ();})
Percentage layout can also be seen as a responsive layout.
The simple and practical percentage layout is very suitable for the layout of mobile WAP pages:
Min-width:320px; max-width:980px; width:100%; overflow-x: hidden; margin: 0 auto
The minimum width 320px, the maximum width 980px, automatically adapts the width between 320px and 980px, looks OK.
In
The tag only needs to set the percentage value of the width attribute, such as width= "40%", not the height attribute, so that the image can be scaled to the original scale.
The blocks in the container can also be arranged as a percentage, such as 60% on the left and 40% on the right.
Thank you for reading! This is the end of the article on "how to use the fixed-width three-column layout in CSS". 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 out 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.
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.