2012-03-29 46 views

回答

0
<style type="text/css"> 
#wrapper{ 
    width:100%; 
    float:left; 
} 
#left{ 
    width:20%; 
    float:left; 
} 
#center{ 
    width:60%; 
    margin:0 auto; 
} 
#right{ 
    width:20%; 
    float:right;  
} 
</style> 

<div id="wrapper"> 
    <div id="left"></div> 
    <div id="center"></div> 
    <div id="right"></div> 
</div> 
3

是的,你可以用display:table屬性來做到這一點。像這樣寫:

.parent{ 
    width:100%; 
    display:table; 
} 
.parent div{ 
    display:table-cell 
} 
.middle{ 
    width:300px; 
    background:red; 
} 
.left{ 
    background:green; 
} 
.right{ 
    background:yellow; 
} 

入住這http://jsfiddle.net/QUVeq/

3

你可以像在例如

http://jsfiddle.net/HCFpE/

添加width: auto;您#left和#right CSS

+0

HTTP ://jsfiddle.net/HCFpE/1/更改內容會導致更改#left和#right寬度.. – user1063113 2012-03-29 07:59:45

+0

Єякісьінш ідеї? :-) – user1063113 2012-03-29 08:06:59

+0

http://robertnyman.com/css3/calc/calc.html – 2012-03-29 08:30:36

相關問題