我想創建一個就像從iphone一個標題欄的佈局: 有div填充剩餘寬度 - 模仿標題欄?
我試圖整理出以下例子,但我不知道怎麼去中間列的寬度擴大,從而它使用所有剩下的空間。我可以在運行時在JavaScript中執行此操作,但是想知道是否有一個css解決方案。那就是:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<style type="text/css">
html, body {
margin: 0px;
padding: 0px;
}
#parent {
background-color: #eee;
width: 100%;
}
#colLeft {
background-color: #ff8b8b;
height: 48px;
display: inline;
}
#colMiddle {
background-color: #c9ffc3;
height: 48px;
display: inline;
text-align: center;
}
#colRight {
background-color: #c3d0ff;
height: 48px;
display: inline;
}
</style>
</head>
<body>
<div id="parent" style="width:100%">
<div id="colLeft">left</div>
<div id="colMiddle">title</div>
<div id="colRight">right</div>
</div>
</body>
</html>
謝謝
使用較小的圖片下一次,請。 – bobthyasian
你看過http://iphone.hohli.com/嗎? – Trufa
什麼是您的瀏覽器支持需求? flex-box應該這樣做... – joholo