我想创建一个就像从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