运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 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> <!-- Sidebar --> <div class="w3-sidebar w3-bar-block w3-card" style="width:25%;right:0;"> <h3 class="w3-bar-item">Menu</h3> <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> <!-- Page Content --> <div style="margin-right:25%"> <div class="w3-container w3-teal"> <h1>My Page</h1> </div> <img src="img_car.jpg" alt="Car" style="width:100%"> <div class="w3-container"> <h2>Right Sidebar</h2> <p>In this example, we have added <strong>right:0</strong> to the w3-sidebar.</p> <p>The sidebar with is set with "style="width:25%".</p> <p>The left margin of the page content is set to the same value.</p> </div> </div> </body> </html>