XHTML 经典三行两列布局,很常用

zhangking zhangking 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
<html>
<head>
<meta http-equiv='Content-Type' content="text/html; charset=gb2312">
<title>XHTML 经典三行两列布局</title>

<style type="text/css">

a:link, visited {color:#004592;text-decoration:none;}
a:hover {color:#004592;text-decoration:underline;}
a:active {color:#004592;text-decoration: none;}

img {border:0px;}

.text {margin: 0px; padding:10px;}

body
{
background: #999;
text-align: center;
color: #333;
font-family: Verdana, Arial, Helvetica, sans-serif;
}

#header
{
margin-left: auto;
margin-right: auto;
padding: 0px;
width: 776px;
height: 64px;
background: #EEE;
text-align: center;
line-height: 64px;
}
/* 注意:line-height=height 可使文本垂直居中 */

#contain
{
margin-left: auto;
margin-right: auto;
width: 776px;
}

#mainbg
{
float: left;
padding: 0px;
width: 776px;
background: #60A179;
}

#left
{
float: left;
margin: 2px 2px 0px 0px;
padding: 0px;
background: #F2F3F7;
width: 200px;
text-align: left;
border:1px solid #EE0000;
}

#right
{
float: right;
margin: 2px 0px 2px 0px;
padding: 0px;
width: 574px;
background: #ccd2de;
text-align: left;
}

#footer
{
clear: both;
margin-right: auto;
margin-left: auto;
padding: 0px;
width: 776px;
height: 60px;
background: #EEE;
}
</style>

</head>

<body>

<!-Begin:头部-->
<div id="header">
<div id="topic">头部(Header)</div>
</div>
<!-End:头部-->

<!-Begin:中部-->
<div id="contain">
<div id="mainbg">

<div id="right">
<div class="text">
右部
<p>段落1</p>
<p>段落2</p>
<p>段落3</p>
<p>段落4</p>
<p>段落5</p>
</div>
</div>

<div id="left">
<div class="text">左部</div>
</div>
<!-注意 left 代码虽然在后边,但是仍然显示在了左边-->
</div>
</div>

<!-End:中部-->

<!-Begin:底部-->
<div id="footer">
底部(footer)
</div>
<!-End:底部-->

</body>
</html>
...全文
评论 14
收藏 已收藏
分享
返回顶部
zhangking
CSS 61,116 成员 60,701 内容