动态 Div 宽度的问题
从我读过的所有内容来看,我的 CSS 应该 调整左侧文本的大小以适应剩余空间,但它似乎在 Chrome 中不起作用(具有讽刺意味的是 IE9 一次渲染了正确的内容)。< br> 我对 CSS 有点菜鸟,所以毫无疑问我缺少了一些东西(以及我不需要的东西)。
该网站可以在这里查看;
baradineholdings.com.au
HTML;
<div id="internal">
<div id="image">
<img src="" alt="" width="563" height="422"/>
</div> <!-- end #image -->
<div id="content">
<p> A whole heap of content goes here. </p>
</div> <!-- end #content -->
</div> <!-- end #internal -->
CSS;
#internal {
width: 100%;
height: auto;
margin: 0;
padding: 0;
}
#image {
width: 563px;
height: auto;
float: right;
right: 0px;
top: 0px;
margin: 0;
}
#content {
display: block;
height: auto;
background-color: #f1f1f1;
float: left;
margin-right: auto;
position: relative;
}
From everything I've read, my CSS should have the left hand text resize to fit the remaining space, but it doesn't seem to work in Chrome (ironically IE9 renders something right for once).
Bit of a noob with CSS so there's undoubtedly something I'm missing (and stuff that I don't need).
The website can be seen here;
baradineholdings.com.au
HTML;
<div id="internal">
<div id="image">
<img src="" alt="" width="563" height="422"/>
</div> <!-- end #image -->
<div id="content">
<p> A whole heap of content goes here. </p>
</div> <!-- end #content -->
</div> <!-- end #internal -->
CSS;
#internal {
width: 100%;
height: auto;
margin: 0;
padding: 0;
}
#image {
width: 563px;
height: auto;
float: right;
right: 0px;
top: 0px;
margin: 0;
}
#content {
display: block;
height: auto;
background-color: #f1f1f1;
float: left;
margin-right: auto;
position: relative;
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题似乎出
在 #content 中。如果删除它,您将在所有浏览器中获得所需的效果。您还需要将#content 上的显示设置为:
否则您的背景颜色将导致问题。
希望这有帮助。
The issue appears to be with the
in #content. If you remove this you get the desired effect in all browsers. You'll also need to set the display on #content to be:
Otherwise your backround-color will cause issues.
Hope this helps.
尝试添加
Try to add