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

วิธีเพิ่มตัวแบ่งลิงก์ในแถบนำทางด้วย CSS


ในการเพิ่มตัวแบ่งลิงก์ในแถบนำทาง ให้ใช้คุณสมบัติ border-right สำหรับองค์ประกอบ

  • ตัวอย่าง

    <!DOCTYPE html>
    <html>
       <head>
          <style>
             ul {
                list-style-type: none;
                margin: 0;
                padding: 0;
             }
             li {
                float: left;
                border-right: 1px solid white;
             }
             li a {
                display: block;
                padding: 8px;
                background-color: orange;
             }
             li:last-child {
                border-right: none;
             }
          </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>
       </body>
    </html>