我在HTML和CSS上玩弄了一下,我遇到了一個我無法解決的問題。繼承人問題的鏈接和圖片:在不同瀏覽器中具有不同高度的HTML元素
[在這裏輸入的形象描述] [1]
上部是火狐,顯示它,我希望它的方式。
下面是Chrome(IE顯示它像鉻)。正如你所看到的,黃色部分的高度不足以用於圖片。
下面的代碼:
<section id="top-content">
<div id="top-content-upper">
<h2>Welcome to our Site</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate </p>
<a href="#">Learn More</a>
<a href="#">Our Work</a>
</div>
<img src="dragon.jpg" alt="dragon" id="featured1">
<img src="underconstrcution.jpg" alt="under construction" id="featured2">
<div id="breadcrumbs">Youre here: Home > Welcome</div>
</section>
和CSS:
#top-content
{
background: green;
padding: 20px 10px;
position: relative;
}
#top-content-upper
{
background: yellow;
padding: 15px 50% 15px 10px;
}
#top-content-upper h2
{
margin-bottom: 15px;
}
#breadcrumbs
{
background: red;
padding: 5px 0 5px 15px
}
#featured1
{
position: absolute;
top: 40px;
left: 600px;
z-index:2;
}
#featured2
{
position: absolute;
top: 80px;
left: 640px;
z-index:1;
}
非常感謝所有的答案。現在我用最小高度解決了它。我要去嘗試漂浮。並感謝鏈接到盒子大小的文章
相關閱讀:http://dowebsitesneedtolookexactlythesameineverybrowser.com/ – 2012-03-09 17:29:19