English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

so that i can have different backround color for the selected link on the pages

2006-08-21 00:46:25 · 2 answers · asked by shraftali 1 in Computers & Internet Programming & Design

see i wanna do the effect only through css only. what i wanna do is something like this http://answers.yahoo.com/dir/index;_ylt=Avfs.EIpW7dEQIV6w51WUgbzy6IX?link=list&sid=396545019&cp=2&tp=153 check this url and findout the page navigation below 1, 2, 3, 4, 5

2006-08-21 03:48:55 · update #1

2 answers

the a active state is only the state of the link if you keep your mouse button down on the link (i.e. not releasing it).

For state of links on the 'active' page you need to have a specific css class or ID created for it with the same attribute as the a:active link:

ex: let's say that in your stylesheet you currently have
a:active{
background-color:#fcc;
}

if you change this to:
a:active, #selectedlink{
background-color:#fcc;
}

or
a:active, .selectedlink{
background-color:#fcc;
}

and add on your html page
2)so simply create the style you want and apply it to your selection (here the

  • tag).

    2006-08-21 01:06:26 · answer #1 · answered by le_gber 3 · 0 0

  • You can use CSS alone for small navigations by using inheritance. One way is to add an id or class to your body tag. So for example, the page representing page 1 will have a body tag of body#one, and the body#two and so on. The styles of your navigation would follow accordingly. So for your first page, you'd have something like:

    body#one #nav li#one { background-color: red; }
    body#one #nav li#two, body#one #nav li#three, body#one #nav li#four { background-color: white; }

    body#two #nav li#one { background-color: white; }

    and so on...

    :active refers to any element that has been activated by user input, for example, a hyperlink you're clicking on while the mouse button is being held down.

    If I understand you correctly, you want your links to retain attributes after being selected. Unless you plan on writing up a ton of CSS, using javascript in combination with CSS would be a much better solution.

    2006-08-21 01:09:45 · answer #2 · answered by achtungbaby 3 · 0 0

    fedest.com, questions and answers