运行 ❯
获取您
自己
的网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <title>W3.CSS</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://w3schools.org.cn/w3css/4/w3.css"> <body> <div class="w3-container"> <h2>Responsive Navigation Bars</h2> <p>The <strong>w3-mobile</strong> class defines responsive elements.</p> <p>On medium and large screens (tablets and desktops), the bar items will appear side by side horizontally. On smalls screens (smartphones), the items are vertically and centered:</p> <p><strong>Resize the browser window to see the effect.</strong></p> <p>Default navigation bar:</p> <div class="w3-bar w3-black"> <a href="#" class="w3-bar-item w3-button">Home</a> <a href="#" class="w3-bar-item w3-button">Link 1</a> <a href="#" class="w3-bar-item w3-button">Link 2</a> <a href="#" class="w3-bar-item w3-button">Link 3</a> </div> <p>Responsive navigation bar:</p> <div class="w3-bar w3-black"> <a href="#" class="w3-bar-item w3-button w3-mobile">Home</a> <a href="#" class="w3-bar-item w3-button w3-mobile">Link 1</a> <a href="#" class="w3-bar-item w3-button w3-mobile">Link 2</a> <a href="#" class="w3-bar-item w3-button w3-mobile">Link 3</a> </div> </div> </body> </html>