Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have a simple CSS question
I have a table with some text and links
i want CSS to just affect the links not the text
<table class="mytable>
<tr><td class="mytd">
My Link Some Text Goes here </td></tr></table>i want to change the formatting for just this link. How do i go about doin that?
I've tried A.mytd:link{font-size: } that
mytable.mytd:link{ }
A.mytable.mytd:link{ }
and they didnt work...
Intel P4 2.6 @ 3.2
1GHz FSB
Asus P4P800
2x256 Kingston DDR400
--->ATi Radeon 9800Pro 128MB<---

okay that didnt show up right
but you get the idea that i was trying to put a code for a linkIntel P4 2.6 @ 3.2
1GHz FSB
Asus P4P800
2x256 Kingston DDR400
--->ATi Radeon 9800Pro 128MB<---

when you want to apply code to a link, you use the 'a' in your code
example
a {color:#ff0000}
im not entirly sure, but if you wanted to add a class so the code only applies to that link, i think you include the class like this


Hi,
I've made a quick example page showing how to assign formatting to only one particular link. Just view the source of that page and its pretty simple.
All you do is put something like #whatever in the CSS, for example:
#whatever { font-size: x-large; }
And then you put an id parameter in the HTML tag, like so:
a href="http://www.whatever.com" id="whatever"> www.whatver.com a/>
(I've left out the angle brackets so that it shows...)

Alternatively you can define a base style, then assign a Class to a second instance of it to add the change, then construct the link as usual, inserting class="classname" to the tag where needed, like this:
CSS:
a { background: transparent; color: #0099cc; font-weight: bold; text-decoration: none; }a.home { font-variant: small-caps; }
HTML:
< a href="contact.html" title="Contact Us">Contact Us</a ><a class="home" href="index.html" title="Home Page">Home Page
So the first link displays the attributes under the 'a' style, while the second one not only inherits these attributes, but also adds smallcaps to it, as defined for the class.

CSS-
h1#grayhead{font-family: "rockwell extra bold", "arial black"; color: #C0C0C0; text-decoration: none}
a: link>h1#grayhead{color: #C0C0C0;}
a: visited>h1#grayhead{color: #FF0066;}Hello -
Might be a little late, but wanted to share with you something I recently used for part of my index.css on a site. Basically the selector means:a:(your link) is a 'child' of the > parent element whose id is "grayhead"
Hope this helps!
-el

I suggest avoiding the use of ID in CSS, keep it for use in HTML to avoid conflicts.
First, it is not fully standards compliant, as it is a pseudo-element which CSS1 cannot interpret. Also consider this snippet of code from my web site:
<label for="name">Your name:</label> <input type="text" id="name" name="Name" size="25" value="Enter your name here" tabindex="1">
See how I use a label for accessibility, which requires a corresponding ID in the element it refers to. If I wanted a background colour for the input box, the ID is already in use. This is why I recommend using Class for CSS at all times for consistency, rather than mixing the two.

![]() |
Web Site Colors
|
View web applications fro...
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |