阅读(1865)

CSS 图片廊

最后一次修改 2017年08月03日

CSS 图片廊

图片廊

T以下是使用CSS创建图片廊:

实例

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"> 
<title>html教程(html.cn)</title> 
<style>


div.img
{
  margin: 2px;
  border: 1px solid #000000;
  height: auto;
  width: auto;
  float: left;
  text-align: center;
}    
div.img img
{
  display: inline;
  margin: 3px;
  border: 1px solid #ffffff;
}
div.img a:hover img {border: 1px solid #0000ff;}
div.desc
{
  text-align: center;
  font-weight: normal;
  width: 120px;
  margin: 2px;
}
</style>
</head>


<body>
<div class="img">
 <a target="_blank" href="javascript;:"><img src="
http://img.php.cn/upload/content/000/000/001/598280112bdfb882.jpg" alt="Klematis" width="110" height="90"></a>
 <div class="desc">Add a description of the image here</div>
</div>
<div class="img">
 <a target="_blank" href="javascript;:"><img src="
http://img.php.cn/upload/content/000/000/001/5982801bcef5b752.jpg" alt="Klematis" width="110" height="90"></a>
 <div class="desc">Add a description of the image here</div>
</div>
<div class="img">
 <a target="_blank" href="javascript;:"><img src="http://img.php.cn/upload/content/000/000/001/5982802b58103356.jpg" alt="Klematis" width="110" height="90"></a>
 <div class="desc">Add a description of the image here</div>
</div>
<div class="img">
 <a target="_blank" href="javascript;:"><img src="http://img.php.cn/upload/content/000/000/001/59828032492bb706.jpg" alt="Klematis" width="110" height="90"></a>
 <div class="desc">Add a description of the image here</div>
</div>
</body>

运行实例 »

点击 "运行实例" 按钮查看在线实例