歌剧布局问题
<div id="header">
<div id="logo">
<h1><a href="http://lookaroundyou.net">Look Around You</a></h1>
</div>
<div id="search">
<input type="text"/>
<input type="button" value="search"/>
</div>
<div id="horNav">
<ul class="horNav">
<li><a class="home" href="#">HOME</a></li>
<li><a class="submit" href="#">SUBMIT</a></li>
</ul>
</div>
</div>
这是CSS:
#logo{
width: 50%;
float: left;
}
#search{
float: right;
width: 50%;
}
#horNav{
clear: both;
overflow: hidden;
display: block;
width: 100%;
}
它在chrome和firefox中工作正常,但在opera中它在div#logo下显示div#search,而不是在相反的两侧内联?
非常感谢
<div id="header">
<div id="logo">
<h1><a href="http://lookaroundyou.net">Look Around You</a></h1>
</div>
<div id="search">
<input type="text"/>
<input type="button" value="search"/>
</div>
<div id="horNav">
<ul class="horNav">
<li><a class="home" href="#">HOME</a></li>
<li><a class="submit" href="#">SUBMIT</a></li>
</ul>
</div>
</div>
this is CSS:
#logo{
width: 50%;
float: left;
}
#search{
float: right;
width: 50%;
}
#horNav{
clear: both;
overflow: hidden;
display: block;
width: 100%;
}
it works fine in chrome and firefox but in opera it displays div#search under div#logo instead inline on oposite sides??
many thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我无法在 Opera 11.10 中重现该问题,请参阅jsfiddle 上的示例,但有一些可能的解决方案/您可以尝试的事情:
max-width
而不是width
来表示#logo
;#logo
和#search
的顺序,并从中删除
float
和width
#标志I can´t reproduce the problem in Opera 11.10, see this example on jsfiddle, but there are a few possible solutions / things you can try:
max-width
instead ofwidth
for#logo
;#logo
and#search
in the html and remove thefloat
andwidth
from#logo