Skip to content

Instantly share code, notes, and snippets.

@cheng470
Last active August 29, 2015 14:07
Show Gist options
  • Save cheng470/de61d060c5bb7597faeb to your computer and use it in GitHub Desktop.
Save cheng470/de61d060c5bb7597faeb to your computer and use it in GitHub Desktop.
固定宽度的三列布局
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body {
text-align: center;
}
.wrapper {
width: 920px;
margin: 0 auto;
text-align: left;
}
.content .primary {
width: 670px;
float: right;
display: inline;/*防止IE中的双外边距浮动产生的bug*/
}
.content .secondary {
width: 230px;
float: left;
display: inline;
}
.content .primary .primary {
width: 400px;
float: left;
display: inline;
}
.content .primary .secondary {
width: 230px;
padding-right: 20px;
float: right;
display: inline;
}
.wrapper, .primary, .secondary {
border: 1px solid;
}
</style>
</head>
<body>
<div class="wrapper">
<div class="header">
<h1>Header</h1>
</div>
<div class="content">
<div class="primary">
<div class="primary">
<p>primary</p>
</div>
<div class="secondary">
<p>secondary</p>
</div>
</div>
<div class="secondary">
<p>secondary</p>
</div>
</div>
<div class="footer">
<p>footer</p>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment