469,349 Members | 1,697 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,349 developers. It's quick & easy.

Can I use a style to only a selection of <a>-hovers not the hole page?

I like to have a small menu where the <a> items have a blue background
on hover like normal window-menu's.
Like this:
<tr onmouseover="style.background='#0000ff';"
onmouseout="style.background='#ffffff';">
<td><a>Menu item 1</a></td>
</tr>

But I don't like to repeat the onmouse...
Is there no way to use a stylesheet where only a selection of cells or
links have this kind of blue background?
Jul 20 '05 #1
2 1491
Michel wrote:
I like to have a small menu where the <a> items have a blue background
on hover like normal window-menu's.


http://css.maxdesign.com.au/listamatic/

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 20 '05 #2
Michel wrote:
I like to have a small menu where the <a> items have a blue background
on hover like normal window-menu's.
Like this:
<tr onmouseover="style.background='#0000ff';"
onmouseout="style.background='#ffffff';">
<td><a>Menu item 1</a></td>
</tr>

But I don't like to repeat the onmouse...
Is there no way to use a stylesheet where only a selection of cells or
links have this kind of blue background?


Yes:

1) Enclose the menu items in a <div> with id or class and use CSS selectors

<div id="menu">
<a ...>blah</a>
</div>

#menu a:hover {...}

2) Apply a class to each <a> element.

<a class="menu" ...>blah</a>

a.menu:hover {...}

Hope that helps. See my site for an example - note how the header, menu
and content links behave differently; and how the internal and external
content links are also different.

--
Mark.
http://tranchant.plus.com/
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Donald Firesmith | last post: by
15 posts views Thread by Matthias Hullin | last post: by
1 post views Thread by JezB | last post: by
3 posts views Thread by ajay2552 | last post: by
5 posts views Thread by Jean Pierre Daviau | last post: by
5 posts views Thread by JackRbt | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.