我有一排四個圖像工作,但我想另一行,但它overlapp對方這樣 HTML/CSS圖片重疊海誓山盟
這就是我想要實現
的index.html
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
<link rel="stylesheet" type="text/css" href="CSS/main.css">
</head>
<body>
<ul>
<li><a class="active" href="#home">Home</a></li>
<li><a href="#contact">Contact</a></li>
</ul>
<div class="main_image"></div>
<div class="image123">
<div class="imgContainer">
<img class="bottom" src="Image/test_image_slot.jpg"/>
<img class="top" src="Image/light_bokeh_edit.jpg"/>
<p>This is image 1</p>
</div>
<div class="imgContainer">
<img class="bottom" src="Image/test_image_slot.jpg"/>
<img class="top" src="Image/dancing.jpg"/>
<p>This is image 2</p>
</div>
<div class="imgContainer">
<img class="bottom" src="Image/test_image_slot.jpg"/>
<img class="top" src="Image/applecloud.jpg"/>
<p>This is image 3</p>
</div>
<div class="imgContainer">
<img class="bottom" src="Image/test_image_slot.jpg"/>
<img class="top" src="Image/chair.jpg">
<p>This is image 4</p>
</div>
</div>
<div class="image123">
<div class="imgContainer">
<img class="bottom" src="Image/test_image_slot.jpg"/>
<img class="top" src="Image/light_bokeh_edit.jpg"/>
<p>This is image 1</p>
</div>
<div class="imgContainer">
<img class="bottom" src="Image/test_image_slot.jpg"/>
<img class="top" src="Image/dancing.jpg"/>
<p>This is image 2</p>
</div>
<div class="imgContainer">
<img class="bottom" src="Image/test_image_slot.jpg"/>
<img class="top" src="Image/applecloud.jpg"/>
<p>This is image 3</p>
</div>
<div class="imgContainer">
<img class="bottom" src="Image/test_image_slot.jpg"/>
<img class="top" src="Image/chair.jpg">
<p>This is image 4</p>
</div>
</div>
</body>
的main.css
ul {
list-style-type: none;
margin: 0;
padding: 0;
background-color: #360836;
text-align:center;
}
li {
display:inline;
}
li a {
display: inline-block;
color: #d14977;
text-align: center;
padding: 14px 16px;
text-decoration: none;
-o-transition:.5s;
-ms-transition:.5s;
-moz-transition:.5s;
-webkit-transition:.5s;
transition:.5s;
}
li a:hover {
color: white;
}
div.main_image {
content:url(../Image/everest.jpg);
max-width: 100%;
height: auto;
width: auto\9;
}
.imgContainer{
float:left;
width:25%;
position:relative;
margin:0 auto;
}
.imgContainer img{
max-width:100%;
height: auto;
position:absolute;
left:0;
-webkit-transition: opacity 1s ease-in-out;
-moz-transition: opacity 1s ease-in-out;
-o-transition: opacity 1s ease-in-out;
transition: opacity 1s ease-in-out;
}
.imgContainer img.top:hover {
opacity:0;
}
我怎樣才能使兩行或圖像的甚至超過兩行棧互不重疊。我想實現這只是使用CSS和HTML,我不想使用JavaScript或jQuery。謝謝
你是什麼意思, 「堆棧」?不同的z索引?那有資格作爲「重疊」... –
喜歡一行4 img和另一行4 img不重疊 – WESTKINz
什麼規則適用於'.image123'?如果浮動div,然後擺脫浮動,或打破/清除:在兩行之間。 –