1. Computing

Discuss in my forum

CSS Navigation Elements

Make Your CSS Navigation Elements Block Elements

By , About.com Guide

When you create a CSS/XHTML Web page, you'll definitely want navigation elements, and the most common way to create navigation is with CSS styled lists. But if you forget one simple thing, your navigation elements can be very difficult for your customers to use.

display: block;

The display: block; property is very important in CSS navigation because navigation buttons and areas are typically meant to be like buttons or blocks of the Web page. If you leave the links in your navigation as display: inline; (the default for a elements), then only the text in your navigation will be clickable.

Try It Out in Your CSS Navigation

If you have created CSS navigation like the navigation demoed on this page, you already have the display:block; property listed (in the "ul#navigation li a" call). Change this to display: inline; and see what happens.

Adding this simple line will help your pages be more accessible while remaining standards-compliant.

©2013 About.com. All rights reserved.