HTML menu bar

 


In this example:

* The menu items are defined within an unordered list <ul>.

* Each menu item is represented by a list item <li>.

* The menu items are styled to be displayed horizontally using float: left.

* Menu item links are styled to have a white color, with padding for spacing.

* When hovering over a menu item link, the background color changes to a darker shade.

You can further customize the appearance and functionality of the menu bar according to your needs. 


Video

https://youtu.be/eQdydesPICY


Code


<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

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

<title>Menu Bar</title>

<style>

  /* CSS for styling the menu */

  ul {

    list-style-type: none;

    margin: 0;

    padding: 0;

    overflow: hidden;

    background-color: #333;

  }


  li {

    float: left;

  }


  li a {

    display: block;

    color: white;

    text-align: center;

    padding: 14px 16px;

    text-decoration: none;

  }


  li a:hover {

    background-color: #111;

  }

</style>

</head>

<body>


<!-- HTML code for the menu -->

<ul>

  <li><a href="#home">Home</a></li>

  <li><a href="#about">About</a></li>

  <li><a href="#services">Services</a></li>

  <li><a href="#contact">Contact</a></li>

</ul>


</body>

</html>





Comments