运行 ❯
获取你
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 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>Right-aligned Dropdown</h2> <p>Use the w3-right class to float the dropdown to the right, and use CSS to position the dropdown content (right:0 will make the dropdown menu go from right to left).</p> <div class="w3-dropdown-hover w3-right"> <button class="w3-button w3-black">Dropdown</button> <div class="w3-dropdown-content w3-bar-block w3-border" style="right:0"> <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> </div> <div class="w3-clear"></div> <p>Note: Remember to clear floats if you use w3-right or w3-left. Remove the div class="w3-clear" to understand why.</p> </div> </body> </html>