pseudo class

  • Thread starter Thread starter Paul M
  • Start date Start date
P

Paul M

Hi
Is it easier to attach a pseudo class to a layer div rather than a table. I
want to have different hyperlink link colours on the same page.
best wishes
Paul M
 
Hi Paul,

Are we speaking about CSS here? A pseudo class selector is available only on very specific element selectors. Divs and tables do
not have any.
 
Hi
Thanks for replying I am not sure, but the affect I am trying to achieve is
similar to the hyperlinks on http://www.tictocdesign.com/ the hyperlinks
are different colours, grey to black on the side of the page and grey to red
elsewhere. I want to make sure that I choose the easiest method (divs or
tables) to achieve this.
Paul M

MD Websunlimited said:
Hi Paul,

Are we speaking about CSS here? A pseudo class selector is available only
on very specific element selectors. Divs and tables do
 
You can define pseudo-classes for any page element. For example, a single
page with this in the head -

<style type="text-css">
<!--
a:link, a:visited, a:active { font-weight:bold; font-size:36px;
color:fuscia; }
a:hover { color:black; }
-->
</style>

will cause every link on the page to correspond to those styles.

If you then add this -

#foo a:hover { color:green; }

then all links will be black on hover EXCEPT those contained in something
with an ID of "foo", like -

<div id="foo"><a href="foo.html">Link this</a></div>

See what is happening here?

You are not 'attaching' anything to anything. You are simply allowing the
styles you have defined to cascade into their specific containers.
 
Thanks Murray
I can't seem to get it to work.I cut and pasted the style section into the
head but it didnt change my hyperlinks.
where do I put the
#foo a:hover { color:green; } in the head or the body
 
Show me your code, please.

You would add that to the stylesheet you pasted into the head.
 
Thanks Murray here is the code on the test page

<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>erterterter</title>
<style type="text-css">
<!--
a:link, a:visited, a:active { font-weight:bold; font-size:36px;
color:fuscia; }
a:hover { color:black; }
-->
</style>

</head>

<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%" id="table1">
<tr>
<td id="foo"><a href="corporategiving.html">test link1</a></td>
</tr>
<tr>
<td><a href="charities.html">test link 2</a></td>
</tr>
</table>

<p>&nbsp;</p>

</body>

</html>
 
OMG - you did exactly what I told you to, even when it was wrong! 8(

Try this, please -

<style type="text/css">
<!--
a:link, a:visited, a:active { font-weight:bold; font-size:36px;
color:red; }
a:hover { color:black; }
#foo a:hover { color:green; }
-->
</style>

(note the replacement of the improper hyphen with the more convention and
syntactically correct slash)

I also changed the color to a REAL name! 8)
 
Thanks Murray
Works a treat
Best wishes
Paul M
Murray said:
OMG - you did exactly what I told you to, even when it was wrong! 8(

Try this, please -

<style type="text/css">
<!--
a:link, a:visited, a:active { font-weight:bold; font-size:36px;
color:red; }
a:hover { color:black; }
#foo a:hover { color:green; }
-->
</style>

(note the replacement of the improper hyphen with the more convention and
syntactically correct slash)

I also changed the color to a REAL name! 8)
 
Hi Murray
Thinking on can I attach a style sheet ( so I can change something site
wide) and still use the extra bit you so kindly gave me like this, it works
in IE 6 can you see any problems with any other browsers.

<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>erterterter</title>
<link rel="stylesheet" type="text/css" href="linkcolours.css">

<style type="text/css">
<!--
#foo a:hover { color:green; }
-->
</style>


</head>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top