Computing.Net > Forums > Web Development > Simple CSS help?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Simple CSS help?

Reply to Message Icon

Name: deity_me
Date: April 1, 2004 at 09:20:37 Pacific
OS: P3 750
CPU/Ram: Win2K
Comment:

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<---



Sponsored Link
Ads by Google

Response Number 1
Name: deity_me
Date: April 1, 2004 at 09:23:29 Pacific
Reply:

okay that didnt show up right
but you get the idea that i was trying to put a code for a link

Intel P4 2.6 @ 3.2
1GHz FSB
Asus P4P800
2x256 Kingston DDR400
--->ATi Radeon 9800Pro 128MB<---


0

Response Number 2
Name: Jamie_McCoy
Date: April 1, 2004 at 16:01:34 Pacific
Reply:

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

Google</a class="link1">

not sure,but try that

Regards, Jamie McCoy


0

Response Number 3
Name: Jamie_McCoy
Date: April 1, 2004 at 16:02:44 Pacific
Reply:

or maybe the class goes after the link, e.g

Regards, Jamie McCoy


0

Response Number 4
Name: Jamie_McCoy
Date: April 1, 2004 at 16:03:41 Pacific
Reply:

grrrrrrrrrrr, never worked

ok ill leave out the tage opener

a href="www.google.com" class="link1"

Regards, Jamie McCoy


0

Response Number 5
Name: jam14online
Date: April 3, 2004 at 03:36:08 Pacific
Reply:

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...)



0

Related Posts

See More



Response Number 6
Name: safeTsurfa
Date: April 3, 2004 at 15:05:37 Pacific
Reply:

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.



0

Response Number 7
Name: LJK
Date: April 11, 2004 at 19:09:24 Pacific
Reply:

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


0

Response Number 8
Name: safeTsurfa
Date: April 12, 2004 at 12:58:55 Pacific
Reply:

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.



0

Sponsored Link
Ads by Google
Reply to Message Icon

Web Site Colors View web applications fro...



Post Locked

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


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Simple CSS help?

css help www.computing.net/answers/webdevel/css-help/2065.html

Simple Javasricpt Help www.computing.net/answers/webdevel/simple-javasricpt-help/3865.html

magazine-style sidebars in HTML? www.computing.net/answers/webdevel/magazinestyle-sidebars-in-html/2368.html