首页htmlui_olHTML Element Style - 如何完全没有固定宽度的李

HTML Element Style - 如何完全没有固定宽度的李

我们想知道如何完全没有固定宽度的李。

<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
ul {
  background: #aaa;
  display: table;
  width: 100%; /* Tables are not 100% width like block elements */
  margin: 0;
  padding: 0;
  list-style: none;
}

li {
  display: table-cell;
  text-align: center;
}

li a {
  display: block;
  padding: 5px 10px;
  color: #fff;
}
</style>
</head>
<body>
  <ul>
    <li><a href="#">Test</a></li>
    <li><a href="#">Test</a></li>
    <li><a href="#">Test</a></li>
  </ul>
</body>
</html>