<!DOCTYPE html>
<html lang="en"><head>
<meta charset="UTF-8">
<title>浮动</title>
<style type="text/css">
.s1{
float: left;
width: 100px;
height: 100px;
background-color: yellow;
}
</style>
</head>
<body>
<div class="box1">a</div>
<span class="s1">hello</span>
</body></html>
<!DOCTYPE html>
<html lang="en"><head>
<meta charset="UTF-8">
<title>简单布局</title>
<style type="text/css">
*{
margin: 0;
padding: 0;
}
.header{
width: 1000px;
height: 150px;
background-color: yellowgreen;
margin: 0 auto;
}
.content{
width: 1000px;
height: 400px;
background-color: orange;
margin: 10px auto;
}
.left{
width: 200px;
height: 100%;
background-color: skyblue;
float: left;
}
.center{
width: 580px;
height: 100%;
background-color: yellow;
float: left;
margin: 0 10px;
}
.right{
width: 200px;
height: 100%;
background-color: pink;
float: left;
}
.footer{
width: 1000px;
height: 150px;
background-color: silver;
margin: 0 auto;
}
</style>
</head>
<body>
<div class="header"></div>
<div class="content">
<div class="left"></div>
<div class="center"></div>
<div class="right"></div>
</div>
<div class="footer"></div>
</body></html>
网友评论