2
我是一個比較新的HTML/CSS。我已經開始開發一個網站,但我的主要「英雄」形象不適合較小的頁面並留下空白區域。如果你能幫助我診斷問題,將不勝感激。CSS背景圖片不適應屏幕尺寸
*/CSS */
#intro {
z-index: 100;
width: 100%;
height: 66%;
background: url("../images/intro2.jpg"); center center no-repeat;
background-size: cover;
background-repeat: no-repeat;
top:10%;
background-position: 0px -150px;
left: 0;
position: absolute;
background-size: 100%;
}
#intro .wrap{
margin: 0 auto;
position: relative;
}
#intro .content{
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
vertical-align: baseline;
}
*/HTML */
<section id="intro">
<div class="wrap">
<div class="content">
<h1 id="welcome"> Your number one choice for music <br> in the south coast </h1>
</div>
</div>
</section>
該網站還可以查看Here
'#style'中有兩個'background-size'屬性;你想保留哪一個?此外,「背景位置」看起來可疑;你確定這就是你想要的嗎? –
第一個背景聲明也看起來不太潔淨。我可能是錯的,但我相信URL(..)語句後應該沒有分號。 – Ideogram
background-position:cover;不要設置寬度或高度的BG - 圖像...應該是好的 – Careen