Search code examples
htmlimagenavigationnavigationbarimagemap

Should I use an image map to create a navigation bar? If not, what would be a better option?


I have recently started to learn web design, so, please bear with me if my question is a bit trivial. My question is: Should I use an Image map to create a navigation bar? If not, what would be a better option?


Solution

  • Only use an image map if you have to use an image.

    Better option: Use appropriate markup and style it with CSS.

    Typical HTML5 markup for navigation would be:

    <nav>
      <ul>
        <li><a href="/">Home</a></li>
        <li><a href="/about">About</a></li>
      </ul>
    </nav>
    

    With CSS, you can remove the default list styling and make the links appear horizontally. There are various ways to achieve this, e.g.:

    nav li {
      display:inline-block;
      list-style-type:none;
    }