Computer >> คอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

ตั้งค่าแถบนำทางให้อยู่ที่ด้านล่างของหน้าเว็บด้วย CSS


หากต้องการตั้งค่าแถบการนำทางที่ด้านล่าง ใช้ตำแหน่ง:คุณสมบัติคงที่ พร้อมคุณสมบัติด้านล่าง .

คุณสามารถลองเรียกใช้โค้ดต่อไปนี้เพื่อใช้งานเมนูที่อยู่ด้านล่าง

ตัวอย่าง

<!DOCTYPE html>
<html>
   <head>
      <style>
         ul {
            list-style-type: none;
            position: fixed;
            bottom: 0;
            width: 100%;
         }
         li {
            float: left;
               border-right: 1px solid white;
         }
         li a {
            display: block;
            padding: 8px;
            background-color: orange;
         }
         li:last-child {
            border-right: none;
         }
         div {
            padding:10px;
            margin-top:10px;
            background-color:white;
            height:1000px;
         }
      </style>
   </head>
   <body>
      <ul>
         <li><a href = "#home">Home</a></li>
         <li><a href = "#news">News</a></li>
         <li><a href = "#contact">Contact</a></li>
         <li><a href = "#about">About</a></li>
      </ul>
      <div>
         <p>Adding demo text to check fixed menu.</p>
         <p>Adding demo text to check fixed menu.</p>
         <p>Adding demo text to check fixed menu.</p>
         <p>Adding demo text to check fixed menu.</p>
         <p>Adding demo text to check fixed menu.</p>
         <p>Adding demo text to check fixed menu.</p>
         <p>Adding demo text to check fixed menu.</p>
         <p>Adding demo text to check fixed menu.</p>
         <p>Adding demo text to check fixed menu.</p>
         <p>Adding demo text to check fixed menu.</p>
         <p>Adding demo text to check fixed menu.</p>
         <p>Adding demo text to check fixed menu.</p>
         <p>Adding demo text to check fixed menu.</p>
         <p>Adding demo text to check fixed menu.</p>
      </div>
   </body>
</html>