【发布时间】:2014-10-29 12:20:02
【问题描述】:
这个社区已经提供了很大的帮助。我有一个菜鸟问题。我确实进行了搜索,但没有出现这种情况,所以如果之前有人问过这个问题,我们深表歉意。
我有一个“导航”div 当前位于包装 div 中。嵌套在我的导航 div 中的是三个子元素,我想相应地定位它们的左侧、中心和右侧。我尝试浮动这三个元素,但它们都堆叠在一侧。我想要左边的 logo div,中间的标题,右边的电话号码。
我知道这些可以通过绝对定位更精确地定位,但是由于我试图保持布局尽可能流畅,还有其他方法吗?
这是我的 HTML
<div class="wrapper">
<div class="nav">
<div class="logo"><em>BLI </em></div>
<div class="header"><em>California's Leader in Workers' Compensation</em></div>
<div class="phonenumber">Call us:<br>
909-256-0525</div>
</div>
还有我的 CSS:
.wrapper{
min-width:1200px;
position:relative;
width:100%;
overflow:auto;}
.nav{
color:#FFFFFF;
font-size:1.563em;
font-weight:bold;
float:left;
font-family: Arial;
background-color:#C7C2C2;
width:100%;
height:80px;
display:inline;
}
.logo{
font-family: Georgia, "Lucida Bright", "DejaVu Serif", Georgia, serif;
font-weight: bold;
font-size: 2em;
width: 50px;
color: #0E2B5E;
top: 9px;
clear: both;
float: left;
}
.header{
text-shadow:black 0.1em 0.1em 0.2em;
padding-top:40px;
clear:both;
width:300px;
text-align:center;
float:left;
}
.phonenumber{
text-shadow: black 0.1em 0.1em 0.2em;
float: left;
font-size: 1em;
padding: 5px;
}
任何一般的响应式设计技巧也将不胜感激。 谢谢!
【问题讨论】: