琢磨了许久 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>三列中列自适应布局</title>
<style type="text/css">
.col{
float: left;
height: 600px;
color: #FF44AA;
font-family: sans-serif;
text-align: center;
}
.col h1{
margin-top: 50px;
}
.col p{
font-size: 20px;
margin-top: 50px;
}
.col img{
}
#page{
padding-left: 400px;
padding-right: 400px;
}
#main{
background: #6F6;
width: 100%;
}
#left{
background: #9F9;
width: 400px;
margin-left: -100%;
position: relative;
right:400px;
}
#right{
background: #3F3;
width: 400px;
margin-right: -400px;
}
</style>
</head>
<body>
<div id="page">
<div id="main" class="col">
<h1>白居易《牡丹》</h1>
<img src="p01.jpg">
<p>绝代只西子,众芳惟牡丹。</p>
</div>
<div id="left" class="col">
<h1>王安石《梅》</h1>
<img src="p02.jpg">
<p>墙角数枝梅,凌寒独自开。</p>
</div>
<div id="right" class="col">
<h1>张学良《咏兰诗》</h1>
<img src="p03.jpg">
<p>花中真君子,风姿寄高雅</p>
</div>
</div>
</body>
</html>
|