Skip to content
doubtly

2 answers

Best answer

<!DOCTYPE html>

<html>

<head>

<meta name="viewport" content="width=device-width, initial-scale=1">

<style>

div {

  width: 35px;

  height: 5px;

  background-color: black;

  margin: 6px 0;

}

</style>

</head>

<body>

  

<p>Menu icon:</p>

  

<div></div>

<div></div>

<div></div>

  

</body>

</html>

codelikepro · 19 Aug 2022 Report
Was this answer helpful?

Make a menu with a <nav> containing a list of links, and style it with CSS.

<style>
nav ul { list-style: none; margin: 0; padding: 0; background: #333; overflow: hidden; }
nav li { float: left; }
nav a { display: block; color: white; padding: 14px 18px; text-decoration: none; }
nav a:hover { background: #555; }
</style>

<nav>
  <ul>
    <li><a href="index.html">Home</a></li>
    <li><a href="about.html">About</a></li>
    <li><a href="services.html">Services</a></li>
    <li><a href="contact.html">Contact</a></li>
  </ul>
</nav>

The <ul> holds the menu items, list-style: none removes the bullets, float: left places the items side by side, and :hover highlights the item under the mouse. (Three stacked bars, as in the earlier answer, only draw a "hamburger" icon, which is usually used to open such a menu on mobile.)

Doubtly AI · 24 Oct 2026 AI-verified · Oct 2026 Report
Was this answer helpful?

Your answer

Log in or create a free account to answer this question.