网页布局入门教程 如何用CSS进行网页布局

2020-05-11 18:09:09易采站长站整理

    <div class="right">  
        <div class="r_sub_left">sub_left   
        </div>  
        <div class=" r_sub_right">sub_right   
        </div>  
    </div>  
</div>  
<div class="footer">footer</div>  
</body>  
</html>  

DEMO:http://Lovejulyer.github.io/Source_Code/Blog_demo/Codes2/hunhebuju04.html

混合布局05(自适应)

XML/HTML Code复制内容到剪贴板

<html">  
<head>  
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
<title>混合布局</title>  
<style>  
body{ margin:0; padding:0; font-size:30px; font-weight:bold}   
div{ text-align:center; line-height:50px}   
.head{ height:100px;background:#9CF}   
.left{ width:20%; height:600px; background:#ccc; float:left}   
.main{margin:0 30%;height:600px; background:#9CC }   
.right{ width:20%; height:600px;background:#FCC; float:right}/*宽度均设为百分比*/   
.footer{ height:50px; background:#9F9; clear:both}   
</style>  
</head>  
  
<body>  
    <div class="head">head</div>  
    <div class="left">left</div>  
    <div class="right">right</div>  
    <div class="main">main</div>  
    <div class="footer">footer</div>  
</body>  
</html>  

DEMO:http://Lovejulyer.github.io/Source_Code/Blog_demo/Codes2/hunhebuju05.html

在网页制作中,面对设计图,网页制作人员一般要遵循的原则是:先考虑设计图中的文字内容和内容模块之间的关系,重点放在编写html结构和语义化,然后考虑布局和变现形式。
倡导结构,样式,行为分离。举例:网页换肤——相同HTML结构,不同CSS样式。