1
如何刪除website.com中在元素下方找到的空格,就像730像素的空格。我一直在擺弄我的css代碼超過一個小時。我似乎無法找出問題所在CSS白色空白問題
HTML:
<div class="element">
<img src="imagesrc">
<div id="Projecttitle" class="Projecttitle">Title goes here</div>
<div id="Projectdescription" class="Projectdescription">Project description goes here</div>
</div>
<div class="element">
<img src="imagesrc">
<div id="Projecttitle" class="Projecttitle">Title goes here</div>
<div id="Projectdescription" class="Projectdescription">Project description goes here</div>
</div>
CSS:
所有的div.element img:nth-of-type(1){
padding-top:80px;
}
div.element div:not(:nth-of-type(1)){
position:relative;
width:auto;
height:auto;
bottom:375px;
}
div.element img{
position:relative;
right:198px;
padding-right:56px;
border:none;
}
.Projecttitle{
text-transform:none;
color:#000;
text-align:left;
letter-spacing:.3px;
font:normal 22px QuaverSans;
margin-left:auto;
margin-right:auto;
overflow:visible;
z-index:0;
vertical-align:middle;
padding-top:15px;
}
#Projecttitle{
position:relative;
bottom:162px;
width:410px;
height:155px;
left:226px;
}
.Projectdescription{
text-transform:none;
color:#000;
text-align:left;
letter-spacing:.3px;
font:normal 17px QuaverSans;
margin-left:auto;
margin-right:auto;
overflow:visible;
z-index:0;
vertical-align:middle;
}
#Projectdescription{
position:relative;
bottom:290px;
width:410px;
height:155px;
left:226px;
z-index:0;
}
你的問題在於第二個元素div(這是第一個元素內)。我會進一步調試它,但是您的html和css需要認真的工作,如果您在對齊元素時遇到問題,可以使用某種網格(引導程序會很好)。 – mfreitas
我不是說你不應該嵌套元素,我只是說你應該給你的頁面更好的結構,以便你可以避免像現在這樣的問題。 – mfreitas