Creating Rollover Effect Using CSS List Menusby: Amrit HallanCreating rollover effect using CSS list menus Ever seen those fancy links where they change the appearance as soon as you place your mouse cursor on them. See a simple example of a rollover effect here. The CSS definition of this simple example goes like this:
This sort of rollover simply changes the color or the look of the underline. Now let us move on to some complex looking rollover. To see what I am talking about, have a look here. First let us view the entire CSS definition of this rollover menu and then we shall discuss what all is happening.
And this is how you use it:
While defining your CSS layout, once you define a main DIV ID, you can define all the tags that belong to that ID; for instance here we have the main DIV called #nav (let it be small for “navigation”). All the tag definitions preceded by #nav belong to this particular DIV ID. Take for instance
As you can see, there is a DIV with an ID nav. This DIV with ID nav further contains a list tag <ul> that further contains its own tag <li>. All the features are inherited downwards. This first definition is self-explanatory. The real fun begins when we define the <li> tag. Here too, all the definitions are fairly simple. The only definition that may nened explanation is list-style-type: none, which means that while displaying the list, there is no need to display any kind of buller before that. Then we come to the <a> tag definition. The crucial part here is:
Again, the padding setting inserts space left and right, and display: block fills the entire bullet space upon the rollover. Without setting the display as block only the background behind the text is changed, as you can see it here, and not the complete block. © 2008 NetVisits, Inc. All rights reserved. |