Skip to content

Instantly share code, notes, and snippets.

@Mark24Code
Last active March 29, 2017 01:33
Show Gist options
  • Save Mark24Code/a93c5d2361cd701b47e9db867aa04228 to your computer and use it in GitHub Desktop.
Save Mark24Code/a93c5d2361cd701b47e9db867aa04228 to your computer and use it in GitHub Desktop.
布局
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>flying_layout</title>
<style type="text/css">
body {
min-width: 600px; /* 2*left + right */
margin:0;
padding: 0;
}
.main-wrapper {
float: left;
width: 100%;
}
.main {
height: 300px;
background-color: rgba(255, 0, 0, .5);
margin-left: 210px;
margin-right: 190px;
}
.left {
width: 200px;
height: 300px;
background-color: rgba(0, 255, 0, .5);
float: left;
margin-left: -100%;
}
.right {
width: 180px;
height: 300px;
background-color: rgba(0, 0, 255, .5);
margin-left: -180px;
float: left;
}
</style>
</head>
<body>
<div class="main-wrapper">
<div class="main">main</div>
</div>
<div class="left">left</div>
<div class="right">right</div>
</body>
</html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>holy_grail_layout</title>
<style type="text/css">
body {
min-width: 600px; /* 2*left + right */
margin:0;
padding: 0;
}
.container {
padding-left: 210px;
padding-right: 190px;
}
.main {
float: left;
width: 100%;
height: 300px;
background-color: rgba(255, 0, 0, .5);
}
.left {
width: 200px;
height: 300px;
background-color: rgba(0, 255, 0, .5);
float: left;
margin-left: -100%;
position: relative;
left: -210px;
}
.right {
width: 180px;
height: 300px;
background-color: rgba(0, 0, 255, .5);
float: left;
margin-left: -180px;
position: relative;
left: 190px;
}
</style>
</head>
<body>
<div class="container">
<div class="main">main</div>
<div class="left">left</div>
<div class="right">right</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment