Css Question
How would I control what these links would look like. CSS is just a little confusing for me on this.
<TD class=primary-links><UL class=links>
<LI class="first last menu-1-1-2"><A class=menu-1-1-2 href="/">Home</A>
How would I control what these links would look like. CSS is just a little confusing for me on this.
<TD class=primary-links><UL class=links>
<LI class="first last menu-1-1-2"><A class=menu-1-1-2 href="/">Home</A>
webwiz posted this at 06:01 — 11th June 2007.
He has: 629 posts
Joined: May 2007
Tell me if I'm wrong, but I suspect you are trying to set the text colo(u)r of the link, and finding that it does not work when you add a rule for, say, the class=links?
I ask, because I found this puzzling at first. Links get special treatment by browsers, so you have to make a rule specifically for the link tag to get 'color' to work. Any of these selectors should let you set the 'color' and any other property you like on the link:
.primary-links a {...}
.first a {...}
.menu-1-1-2 {...}
You only need enough to target the link(s) you need. No need for all those classes, I feel sure.
If this does not answer your question, I suggest taking a look at a CSS guide or a tutorial. I can recommend these folks in Sunny Sydney:
http://www.westciv.com/
Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;
demonhale posted this at 06:11 — 11th June 2007.
He has: 3,278 posts
Joined: May 2005
first you need to properly tag your html codes, and set classes that have no spaces and are properly quoted like so:
<td class="style1"><ul class="links">
<li class="menu"><a class="menu112" href="/">Home</a>
then you can add on your css file definitions for colours of hover, and the links via classes... in your case, since the link has a class name "menu112" you can style this by:
.menu112 a{
color: #fff;
background: #000;
}
.menu112 a:hover{
color: #fff;
background: #000;
}
learn more at w3c.org
webwiz posted this at 00:19 — 13th June 2007.
He has: 629 posts
Joined: May 2007
@demonhale:
The original poster may be confused by this. It is perfectly valid to have multiple class names in the "class" attribute. This, for example:
Cordially, David.
--
Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;
demonhale posted this at 01:48 — 13th June 2007.
He has: 3,278 posts
Joined: May 2005
Yes it is valid to have multiple classes, but for basics and semantics, it's better to assign one and apply standard mock-up first before focusing too much on multiple classes...
webwiz posted this at 03:10 — 13th June 2007.
He has: 629 posts
Joined: May 2007
@demonhale:
But you wrote:
You seemed to be saying that the OP's code is somehow wrong or invalid, which is not true. I didn't want webmaster_guild to be left with the impression that his code was being criticised. It seemed to me a perfectly valid question that deserved a constructive response.
I don't see what this has to do with semantics, either. Sorry.
Cordially, David.
--
Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;
demonhale posted this at 07:14 — 13th June 2007.
He has: 3,278 posts
Joined: May 2005
@webwiz, look carefully at the tags Wguild presented, first the html tags are capitalized which would work per se, but not XHTML valid, look at the class calls, some have quotes and some have no quotes... It's best to guide them with best practices, although I said I agree with multiple classes, it's best to still use single class, and classes without dashes, or classes with quotes... It would still work either way, but making the markup semantic by starting at the basic coding practice of properly quoting, small letters for html tags, etc...
And answering his question is the main purpose of the thread, I guess it's answered now...
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.