布局

左侧固定宽度,右侧自适应.

方案一:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<style>
*{
margin: 0;padding: 0;
}
.left , .main {
height: 165px;
}
.left {
float: left;width: 200px;background: red;
}
.main {
padding-left: 200px;background: blue;
}
</style>

<body>
<div class="con">
<div class="left">left</div>
<div class="main">main</div>
</div>
</body>

方案二:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<style>
*{
margin: 0;padding: 0;
}
.con {
position: relative;
}
.left , .main {
top: 0;
height: 165px;
}
.left {
position: absolute;
left: 0;
width: 200px;
background: red;
}
.main {
padding-left: 200px;
background: blue;
}
</style>

<div class="con">
<div class="left">left</div>
<div class="main">main</div>
</div>

两侧固定宽度,中间自适应.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<style>
*{
margin: 0;padding: 0;
}
.con{
overflow: hidden
}
.left , .main ,.right{
height: 165px;
}
.left {
width: 200px;
background: red;
float: left;
}
.right {
width: 200px;
background: red;
float: right;
}
.main {
background: blue;
width: 100%;
padding: 0 200px;
}
</style>

<div class="con">
<div class="left">left</div>
<div class="right">right</div>
<div class="main">main</div>
</div>
-------------本文结束感谢您的阅读-------------