|
A c t i o n f o r L i b r a r i e s
— A p r i l 2 0 0 4
The Internet ConnectionBy Michael Sauers
Rethinking Lists: Coding in CSS (Part I) Many library Web sites make use of lists as menus, frequently on the home page, if not elsewhere. Most often, bullets are not the desired format for a menu, so many Web designers code their menus like this: XHTML Code
<p>
Resulting Menu But if you look at this menu, it is actually a list. (Whether it is an unordered or ordered list may be a matter for debate, which I'll ignore here.) But if we set up this menu as a list (below) using standard XHTML coding, bullets result. XHTML Code
<ul>
Resulting Bulleted List
However, with a little bit of CSS, a Web designer can make the bullets disappear. We'll create a list that looks exactly the same as the first, paragraph-based sample list above, but this list will be coded using proper CSS: CSS Code
ul {margin: 0; padding: 0; list-style-type: none;}
The "margin" and "padding" properties have been set to zero to eliminate both the margins and padding that the browser automatically adds to list items. (Feel free to change these settings as required by your Web page design.) The "list-style-type" property replaces the "type" property that HTML designers use to change the bullet style. In this case, setting the property to "none" turns the bullets off. (Something you can't do in markup.) Next month in "Rethinking Lists: Coding in CSS (Part II)," we'll add hyperlinks and create rollover effects without using any JavaScript. Next Article | Previous Article | Table of Contents | BCR Publications Comments to:
shoffhin@bcr.org |