In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
这篇文章将为大家详细讲解有关DIV+CSS如何实现混合布局,小编觉得挺实用的,因此分享给大家做个参考,希望大家阅读完这篇文章后可以有所收获。
1、混合布局
在了解了一列、两列和三列布局之后,混合布局也就不难理解了,混合布局也可以叫综合型布局,那么混合布局就可以在一列布局的基础之上,分为两列布局,三列布局,网页布局的结构普遍都是三列布局,但是在三列布局的基础上,可以根据实际需求,对网页再进行划分。
混合布局 *{margin:0;padding:0;} #header{ height:50px; background:blue; } #main{ width:100%; overflow:hidden; } #main .main-left{ width:20%; height:800px; background:lightgreen; float:left; } #main .main-right{ width:80%; height:800px; float:right; } #main .main-right .right-l{ width:80%; height:800px; background:yellow; float:left; } #main .main-right .right-r{ width:20%; height:800px; background:pink; float:right; } #footer{ height:50px; background:gray; } 头部 左边 右-左 右-右 页脚
2、固定宽度混合布局
固定宽度的混合布局结构,同固定宽度的三列布局模式相同。
固定宽度混合布局 *{margin:0;padding:0;} #header{ height:50px; background:blue; } #main{ width:960px; margin:0 auto; overflow:hidden; } #main .main-left{ width:200px; height:800px; background:lightgreen; float:left; } #main .main-right{ width:760px; height:800px; float:right; } #main .main-right .right-l{ width:560px; height:800px; background:yellow; float:left; } #main .main-right .right-r{ width:200px; height:800px; background:pink; float:right; } #footer{ width:960px; height:50px; background:gray; margin:0 auto; } 头部 左边 右-左 右-右 页脚
3、自适应混合布局
自适应混合布局是对三列自适应布局的改进。
自适应混合布局 *{margin:0;padding:0;} #header{ height:50px; background:blue; } #main{ width:100%; position:relative; } #main .main-left{ width:20%; height:800px; background:red; position:absolute; left:0; top:0; } #main .main-center{ height:800px; background:lightgreen; margin:0 20%; } #main .main-right{ width:20%; height:800px; background:pink; position:absolute; right:0; top:0; } #footer{ height:50px; background:gray; } 头部 设计网页的第一步就是设计版面布局,搭建网站结构,网页排版的合理性,在一定程度上也影响着网站整体的布局以及后期的优化。一个好的网站形象能更容易地吸引用户、留住用户。因此,网站首页第一屏的排版非常重要,很多时候能决定用户的去与留。 右列 左列 页脚
4、混合布局的应用
混合布局在网站中应用比较广泛,再复杂的布局结构,他们的原理都是相通的,可以举一反三。网页布局就是依据内容、功能的不同,使用 CSS 对元素进行格式设置,根据版面的布局结构进行排列,那么布局也就是元素与元素之间的关系,或者向一边看齐,或者精准定位,或者有一定间距,或者嵌套,或者相互堆叠,使元素按照设计稿的样式漂亮的呈现在网页上。
混合布局 *{margin:0;padding:0;} #header{ height:30px; background:blue; margin-bottom:10px; } #nav{ width:960px; margin:0 auto; margin-bottom:10px; } #main{ width:960px; height:800px; margin:0 auto; overflow:hidden; } #main .left{ width:200px; height:800px; background:lightgreen; float:left; } #main .right{ width:750px; height:800px; float:right; } #main .right .sup{ height:200px; margin-bottom:10px; } #main .right .sup-left{ width:370px; height:200px; background:pink; float:left; } #main .right .sup-right{ width:370px; height:200px; background:orange; float:right; } #main .right .middle{ height:300px; background:yellow; margin-bottom:10px; } #main .right .sub{ height:280px; background:purple; } #footer{ width:960px; height:50px; background:gray; margin:0 auto; margin-top:10px; } #nav ul{ list-style:none; background:lightgray; overflow:hidden; } #nav li{ float:left; } #nav li a{ display:block; color:black; width:104px; height:30px; line-height:30px; text-decoration:none; text-align:center; } #nav .home{ width:128px; } #nav li a:hover{ color:white; background:green; } 头部 首页 新闻 热点 动态 直播 地图 服务 社区 关于我们 左边 右-左 右-右 右-中 右-下 页脚 关于"DIV+CSS如何实现混合布局"这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,使各位可以学到更多知识,如果觉得文章不错,请把它分享出去让更多的人看到。
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.