如何將鏈接居中放在我的圖片下方,我嘗試了一切。當我使用clear:both
這幫助了我,但是然後我的圖像在一列中,我不想那樣。所以基本上我想讓每一張圖片都集中在鏈接/文本中。我知道這個HTML/CSS不包含我想放在圖片下面的鏈接,我刪除了所有可能令人困惑的內容。圖片下方的居中鏈接
謝謝。
* {
margin: 0;
padding: 0;
text-decoration: none;
list-style: none;
}
html {
height: 100%;
background-color: #F0FFF0;
}
body {
height: 100%;
width: 100%;
font-size: 100%;
margin: 0;
}
.container {
display: box;
width: 100%;
height: 100%;
margin: 5%;
padding: 0%;
clear: both;
}
.products img {
width: 31%;
height: 31%;
position: relative;
float: left;
display: inline;
margin: 0 2% 3% 0%;
}
<!DOCTYPE>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Products</title>
<link rel="stylesheet" type="text/css" href="css/products.css" />
</head>
<body>
<div class="container">
<div class="products">
<a href="#">
<img src="images/tunel.jpg" alt="Product name">
</a>
<a href="#">
<img src="images/tunel.jpg" alt="Product name">
</a>
<a href="#">
<img src="images/tunel.jpg" alt="Product name">
</a>
<a href="#">
<img src="images/tunel.jpg" alt="Product name">
</a>
<a href="#">
<img src="images/tunel.jpg" alt="Product name">
</a>
<a href="#">
<img src="images/tunel.jpg" alt="Product name">
</a>
<a href="#">
<img src="images/tunel.jpg" alt="Product name">
</a>
<a href="#">
<img src="images/tunel.jpg" alt="Product name">
</a>
<a href="#">
<img src="images/tunel.jpg" alt="Product name">
</a>
</div>
</div>
</body>
</html>
哪裏是文字? – Aziz