0
這是我對響應式設計的第一次嘗試,我不太清楚。正如在第一個屏幕截圖中看到的塔圖像重疊一個div,我不知道我做錯了什麼。這裏的圖片:http://postimg.org/image/l9ax77rhz/css響應頁面上的圖像重疊
容器的寬度是1170px,我想觸發圖像和文本的縮放,一旦屏幕尺寸下降到該點以下。圖片在這裏:http://postimg.org/image/n420djzlj/然後降到760以下的部分開始重疊。我基本上想要解決重疊問題,並在下面的標題和文本的小屏幕上顯示圖像。
任何人都可以向我解釋如何做到這一點或我做錯了什麼? Html and css below
<style>
.lenovo-container {
width: 1170px;
height: 381px;
min-width: 858px;
}
.lenovo-container img {
float: left;
}
@media (max-width:1170px) {
img {
max-width: 100%;
height: auto;
}
.lenovo-container {
max-width: 100%
@media (max-width: 858) {
.lenovo-container p {
display: block;
}
}
</style>
<div class="lenovo-container">
<img class=" wp-image-1498 size-full alignnone" src="wp-content/uploads/2015/06/Rack-server-e1434645252235.jpg" alt="Rack server" width="500" height="381" />
<h2>Rack Servers</h2>
<p>Lenovo ThinkServers and System x Rack Servers are Ideal for small to medium-sized business and feature power-efficient designs, segmented workloads, and fit-for-purpose applications.</p>
<div class="product-button" style="vertical-align: bottom;">
<div class="button-inner-product"><a href="http://shop.lenovo.com/us/en/systems/servers/racks/" target="_blank">Learn more</a>
</div>
</div>
</div>
<br>
<div class="aligncenter" style="width: 1170px; display: block; vertical-align: bottom">
<hr />
</div>
<div class="lenovo-container">
<img class="alignnone size-full wp-image-1565" src="wp-content/uploads/2015/06/Lenovo-server-e1434648963684.jpg" alt="Lenovo server" width="500" height="520" />
<h2>Tower Servers</h2>
<p>Lenovo tower servers provide the performance, reliability, and easy-to-use tools to manage your file/print and point-of-sale workloads.</p>
</div>
感謝您的答覆。這確實修復了重疊的div。但是,現在,當我縮放窗口時,圖像和文本不會隨之縮放,文本也不再在圖像的右側 – Jarrel09
您嘗試了最後一個建議嗎? –
是的,我將Lenovo類中的height屬性更改爲'auto'並添加了「overflow:hidden;」我刪除了.lenovo-container img float,並將其添加到您提供的下兩個代碼塊中。下面是我的代碼:[http://postimg.org/image/6io1pnrql/]以及這個頁面的樣子[http://postimg.org/image/u4dn4gp7t/] – Jarrel09