<!DOCTYPE html>
<html>
<head>
<title>W3.CSS(w3cschool.cn)</title>
<meta name="viewport" content="width=device-width, initial-scale=1" charset="UTF-8">
<link rel="stylesheet" href="https://7npmedia.w3cschool.cn/w3.css">
</head>
<body>
<div class="w3-container">
<h2>导航栏大小</h2>
<p>使用width属性自定义列表项的宽度(注意:在较小的屏幕上,它们将转换为100%):</p>
<p>默认有两个项目:</p>
<div class="w3-bar w3-border w3-light-grey">
<a href="#" class="w3-bar-item w3-button w3-mobile w3-green">链接 1</a>
<a href="#" class="w3-bar-item w3-button w3-mobile">链接 2</a>
</div>
<p>两项,已定制:</p>
<div class="w3-bar w3-border w3-light-grey">
<a href="#" style="width:50%" class="w3-bar-item w3-button w3-mobile w3-green">链接 1</a>
<a href="#" style="width:50%" class="w3-bar-item w3-button w3-mobile">链接 2</a>
</div>
<p>两个项目<strong>居中:</strong></p>
<div class="w3-bar w3-border w3-light-grey w3-center">
<a href="#" style="width:50%" class="w3-bar-item w3-button w3-mobile w3-green">链接 1</a>
<a href="#" style="width:50%" class="w3-bar-item w3-button w3-mobile">链接 2</a>
</div>
<p>三个项目:</p>
<div class="w3-bar w3-border w3-light-grey">
<a href="#" style="width:33.33%" class="w3-bar-item w3-button w3-mobile w3-green">链接 1</a>
<a href="#" style="width:33.33%" class="w3-bar-item w3-button w3-mobile">链接 2</a>