1. Home
  2. Computing & Technology
  3. Web Design / HTML

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.

Explore Web Design / HTML
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. CSS
  5. Advanced CSS
  6. CSS Navigation Elements - Make Them a Block Element - CSS Navigation>

©2009 About.com, a part of The New York Times Company.

All rights reserved.