Tab menu ở giữa màn hình
RUN
<!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> body { margin: 0; font-family: Arial, Helvetica, sans-serif; } .topnav { position: relative; overflow: hidden; background-color: #333; } .topnav a { float: left; color: #f2f2f2; text-align: center; padding: 14px 16px; text-decoration: none; font-size: 17px; } .topnav a:hover { background-color: #ddd; color: black; } .topnav a.active { background-color: #4CAF50; color: white; } .topnav-centered a { float: none; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); } .topnav-right { float: right; } /* Responsive navigation menu (for mobile devices) */ @media screen and (max-width: 600px) { .topnav a, .topnav-right { float: none; display: block; } .topnav-centered a { position: relative; top: 0; left: 0; transform: none; } } </style> </head> <body> <div class="topnav"> <!-- Link đặt ở giữa --> <div class="topnav-centered"> <a href="#home" class="active">Trang chủ</a> </div> <!-- Link đặt bên trái (mặc định) --> <a href="#news">Tin tức</a> <a href="#contact">Liên hệ</a> <!-- Link đặt bên phải --> <div class="topnav-right"> <a href="#search">Tìm kiếm</a> <a href="#about">Về chúng tôi</a> </div> </div> <div style="padding-left:16px"> <h2>Thanh điều hướng với tab menu ở giữa màn hình</h2> <p>Một vài nội dung..</p> </div> </body> </html>
PHÓNG TO