我有一個網站,當用戶懸停在圖像上,figcaption會滑動。創建一個響應<figcaption>
我的屏幕分辨率是1024 x 768,圖像分辨率是300 x 400像素。它適用於我的屏幕分辨率。最近我意識到一個響應式網站的重要性,所以我試圖將我的整個網站變成一個響應式網站。但是,然後我的figcaption不會像1366 x 768分辨率的工作。下面是我使用的代碼和試圖解釋我遇到的問題的圖像。
我使用的每張圖都是300x400。我在#hello圖中使用了寬度:30%,因爲有3張圖片,所以我給它們分別設置了一個寬度:30%。
守則image.php:
<div id="hello">
<figure>
<img src="hello.png" alt="hello"/>
<figcaption>
<p>Hello </p>
<br/>
<p>Hello everyone!</p>
</figcaption>
</figure>
</div>
我的CSS:
#hello{
width:100%;
}
#hello figure{
width: 30%;
height: 400px;
overflow:hidden;
float:left;
text-align: center;
font-size: 15px;
font-family: 'Fredericka the Great', cursive;
font-weight: bold;
display: block;
padding:0;
margin: 15px;
}
#hello figcaption{
position: relative;
top: -105px;
background: rgba(239, 239, 239, 0.6);
-webkit-transition: top 1s ease;
-ms-transition: top 1s ease;
-moz-transition: top 1s ease;
-o-transition: top 1s ease;
}
#hello figure:hover figcaption{
top:-210px;
}
當它在1024×768的分辨率,它有沒有問題:
(還未出現徘徊1024×768分辨率)
懸停在1024×768分辨率
當它在1366×768分辨率,它具有figcaption溢出的問題。
請與我分享你的寶貴的知識和建議。非常感謝。
編輯:如果我設置figcaption寬度爲300像素的(增加線寬:300到#hello figcaption),它是這樣的:
爲什麼不使圖像或圖形元素的標題寬? – user1721135
我試圖將figcaption的寬度設置爲300px,但那不起作用。我添加了另一張圖片,我將figcaption的寬度設置爲300px。 –