首页htmlui_olHTML Element Style - 如何布局UL作为表

HTML Element Style - 如何布局UL作为表

我们想知道如何布局UL作为表。

<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
ul {
  display: table;
  table-layout: fixed;
  width: 100%;
  border: 1px solid #c2c2c2;
  -moz-box-sizing: border-box;
  box-sizing: border-box;
}

li {
  text-align: center;
  display: table-cell;
  border-right: 1px solid #c2c2c2;
}

li:last-child {
  border: none; /* no right border on last li */
}
</style>
</head>
<body>
  <ul>
    <li>Item1</li>
    <li>Item2</li>
    <li>Item3</li>
    <li>Item4</li>
    <li>Item5</li>
  </ul>
</body>
</html>