以表格格式排列图像

时间:2017-10-28 05:38:18

标签: html css

如何以表格格式正确设置图像,请参阅图像我不想将其设置为ul li formate。我需要它在表格格式。 (没有使用)。

演示:https://www.w3schools.com/code/tryit.asp?filename=FKXWYDRKTBEP

enter image description here

1 个答案:

答案 0 :(得分:0)

尝试一下......

<!DOCTYPE html>
<html>
<style>
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial;
}

.header {
  text-align: center;
  padding: 32px;
}

/* Create two equal columns that floats next to each other */
.column {
  float: left;
  width: 50%;
  padding: 10px;
}

.column img {
  margin-top: 12px;
}

/* Clear floats after the columns */
.row:after {
  content: "";
  display: table;
  clear: both;
}
</style>
<body>

<!-- Header -->
<div class="header">
  <h1>Image Grid</h1>
</div>

<!-- Photo Grid -->
<div class="row"> 
  <div class="column">
  <img src="/w3images/wedding.jpg" style="width:100%">
  <img src="/w3images/rocks.jpg" style="width:100%">
  <img src="/w3images/falls2.jpg" style="width:100%">
  <img src="/w3images/paris.jpg" style="width:100%">
  <img src="/w3images/nature.jpg" style="width:100%">
  <img src="/w3images/mist.jpg" style="width:100%">
  <img src="/w3images/paris.jpg" style="width:100%">
  </div>
  <div class="column">
  <img src="/w3images/underwater.jpg" style="width:100%">
  <img src="/w3images/ocean.jpg" style="width:100%">
  <img src="/w3images/wedding.jpg" style="width:100%">
  <img src="/w3images/mountainskies.jpg" style="width:100%">
  <img src="/w3images/rocks.jpg" style="width:100%">
  <img src="/w3images/underwater.jpg" style="width:100%">
  </div>  
  <div class="column">
  <img src="/w3images/wedding.jpg" style="width:100%">
  <img src="/w3images/rocks.jpg" style="width:100%">
  <img src="/w3images/falls2.jpg" style="width:100%">
  <img src="/w3images/paris.jpg" style="width:100%">
  <img src="/w3images/nature.jpg" style="width:100%">
  <img src="/w3images/mist.jpg" style="width:100%">
  <img src="/w3images/paris.jpg" style="width:100%">
  </div>
  <div class="column">
  <img src="/w3images/underwater.jpg" style="width:100%">
  <img src="/w3images/ocean.jpg" style="width:100%">
  <img src="/w3images/wedding.jpg" style="width:100%">
  <img src="/w3images/mountainskies.jpg" style="width:100%">
  <img src="/w3images/rocks.jpg" style="width:100%">
  <img src="/w3images/underwater.jpg" style="width:100%">
  </div>
</div>

</body>
</html>