Horizontal header menu implemented with CSS3

Horizontal header menu implemented with CSS3

Result:

Implementation Code

html

<nav class="dropdownmenu">
  <ul>
    <li><a href="http://www.jochaho.com/wordpress/">123WORDPRESS.COM</a></li>
    <li><a href="http://www.jochaho.com/wordpress/about-pritesh-badge/">jb51</a></li>
    <li><a href="#">Articles on HTML5 & CSS3</a>
      <ul id="submenu">
        Difference between SVG vs. Canvas
        <li><a href="http://www.jochaho.com/wordpress/new-features-in-html5/">New features in HTML5</a></li>
        <li><a href="http://www.jochaho.com/wordpress/creating-links-to-sections-within-a-webpage/">Creating links to sections within a webpage</a></li>
      </ul>
    </li>
    <li><a href="http://www.jochaho.com/wordpress/category/news/">News</a></li>
    <li><a href="http://www.jochaho.com/wordpress/about-pritesh-badge/">Contact Us</a></li>
  </ul>
</nav>

CSS3

.dropdownmenu ul, .dropdownmenu li {
	margin: 0;
	padding: 0;
}
.dropdownmenu ul {
	background: gray;
	list-style: none;
	width: 100%;
}
.dropdownmenu li {
	float: left;
	position: relative;
	width:auto;
}
.dropdownmenu a {
	background: #30A6E6;
	color: #FFFFFF;
	display: block;
	font: bold 12px/20px sans-serif;
	padding: 10px 25px;
	text-align: center;
	text-decoration: none;
	-webkit-transition: all .25s ease;
	-moz-transition: all .25s ease;
	-ms-transition: all .25s ease;
	-o-transition: all .25s ease;
	transition: all .25s ease;
}
.dropdownmenu li:hover a {
	background: #000000;
}
#submenu {
	left: 0;
	opacity: 0;
	position: absolute;
	top: 35px;
	visibility: hidden;
	z-index: 1;
}
li:hover ul#submenu {
	opacity: 1;
	top: 40px; /* adjust this as per top nav padding top & bottom comes */
	visibility: visible;
}
#submenu li {
	float: none;
	width: 100%;
}
#submenu a:hover {
	background: #DF4B05;
}
#submenu a {
	background-color:#000000;
}

The above is the details of the horizontal title menu implemented by CSS3. For more information about CSS3 title menu, please pay attention to other related articles on 123WORDPRESS.COM!

<<:  Detailed explanation of TypeScript's basic types

>>:  Detailed explanation of the code for implementing six sieve styles using HTML grid layout

Recommend

How to mount a disk in Linux and set it to automatically mount on boot

Knowing that everyone's time is precious, I w...

iview implements dynamic form and custom verification time period overlap

Dynamically adding form items iview's dynamic...

Detailed explanation of MySQL database (based on Ubuntu 14.0.4 LTS 64 bit)

1. Composition and related concepts of MySQL data...

Steps to build a Docker image using Dockerfile

Dockerfile is a text file that contains instructi...

The complete version of the common Linux tool vi/vim

Why learn vim Linux has a large number of configu...

Develop a vue component that encapsulates iframe

Table of contents 1. Component Introduction 2. Co...

Vue must learn knowledge points: the use of forEach()

Preface In front-end development, we often encoun...

Do you know all 24 methods of JavaScript loop traversal?

Table of contents Preface 1. Array traversal meth...

A brief analysis of JS original value and reference value issues

Primitive values ​​-> primitive types Number S...

How to build a new image based on an existing image in Docker

Building new images from existing images is done ...

Practical operation of using any font in a web page with demonstration

I have done some research on "embedding non-...

MySQL 5.7.21 installation and configuration tutorial

The simple installation configuration of mysql5.7...