473,326 Members | 2,012 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

ID Selector problem

Hi,
I am having some grieve with the following part of my CSS, basically
when using a composite selector using an ID as the first element the
it doesn't display the expected results. Am I doing something
incorrect? For example my CSS goes something like this:

#leftnavbar a:link {
color: #333;
text-decoration: none;
}
#leftnavbar a:visited {
color: #FFF;
}

#topnavbar a:link {
color: #000;
}
#topnavbar a:visited {
color: #FFF;
}

However, for some reason both within dreamweaver and Explorer all the
links are using the #topnavbar colours? i.e. the #topnavbar selector
is overriding the #leftnavbar selector, even standard links in the
general "body" of the document are being changed to the #topnavbar
colours when they should stay as links normally would. What am I doing
wrong?

Thanks

Zane
Jul 20 '05 #1
4 2757
Zane wrote:
#leftnavbar a:link {
color: #333;
text-decoration: none;
}
#leftnavbar a:visited {
color: #FFF;
}

#topnavbar a:link {
color: #000;
}
#topnavbar a:visited {
color: #FFF;
}

However, for some reason both within dreamweaver and Explorer all the
links are using the #topnavbar colours? i.e. the #topnavbar selector
is overriding the #leftnavbar selector, even standard links in the
general "body" of the document are being changed to the #topnavbar
colours when they should stay as links normally would. What am I doing
wrong?


The CSS looks OK. So either you are hallucinating, or there's a problem
that is not apparent from your code snippet, either in your HTML code or
the stylesheet. Give us the URL so we can see the whole thing in context!
Matthias

Jul 20 '05 #2
za*********@hotmail.com (Zane) wrote:
#leftnavbar a:link {
color: #333;
text-decoration: none;
}
#leftnavbar a:visited {
color: #FFF;
}

#topnavbar a:link {
color: #000;
}
#topnavbar a:visited {
color: #FFF;
}

However, for some reason both within dreamweaver and Explorer all the
links are using the #topnavbar colours? i.e. the #topnavbar selector
is overriding the #leftnavbar selector, even standard links in the
general "body" of the document are being changed to the #topnavbar
colours when they should stay as links normally would. What am I doing
wrong?


The CSS looks okay, (though you really should set a background colour
whenever you set a foreground colour). So the problem is probably with
the HTML. Post a URL.

Steve

--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <st***@pugh.net> <http://steve.pugh.net/>
Jul 20 '05 #3
Zane wrote:
Hi,
I am having some grieve with the following part of my CSS, basically
when using a composite selector using an ID as the first element the
it doesn't display the expected results. Am I doing something
incorrect? For example my CSS goes something like this:

#leftnavbar a:link {
color: #333;
text-decoration: none;
} [snip] However, for some reason both within dreamweaver and Explorer all the
links are using the #topnavbar colours? i.e. the #topnavbar selector
is overriding the #leftnavbar selector, even standard links in the
general "body" of the document are being changed to the #topnavbar
colours when they should stay as links normally would. What am I doing
wrong?


There's nothing obviously wrong. I suspect there's a problem with your HTML
(perhaps you aren't closing the #topnavbar element in the right place?).
Validate your HTML and if you still have trouble, give a URL to a testcase.
--
Jim Dabell

Jul 20 '05 #4
Zane wrote on 13 aug 2003 in comp.infosystems.www.authoring.stylesheets:
However, for some reason both within dreamweaver and Explorer all the
links are using the #topnavbar colours? i.e. the #topnavbar selector
is overriding the #leftnavbar selector, even standard links in the
general "body" of the document are being changed to the #topnavbar
colours when they should stay as links normally would. What am I doing
wrong?


There is a difference between:

#topnavbar a:hover { color: #0f0; }

and

a#topnavbar:hover { color: #0f0; }

the first <a > expects a parent with the id topnavbar

<div id=topnavbar><a href=''>...

the second <a > expects to be the owner of the id topnavbar

<a id=topnavbar href=''>...

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Lian Liming | last post by:
Hi, The language in my web site may be Simplified Chinese or English. I want to define different styles for each language. For each language, the http header is different. <meta name="language"...
2
by: tagbert | last post by:
I'm trying to localize the setting of colors on a series of webpages by defining color palettes that will be used for various page areas. I've defined some palette classes like .clrLt, .clrMd,...
25
by: Tim & Alethea Larson | last post by:
In order to mark links leaving my site, I recently added this rule to my stylesheet. A:after { content: "\2197" } The character is a northeast-pointing arrow, since that seems to be fairly...
1
by: John Rowe | last post by:
I run the web site for a University department. A few of my authors will carefully write: <h3>Title</h3> <p>Some text here.</p> <p>Second paragraph.</p> Most of us can't be bothered(!): ...
0
by: Patrick | last post by:
I'm working on a contact management application, and need a hand with one aspect... Here's what I want to create: ------------------------------------ A form split into two parts. There is a...
2
by: Chris Sharman | last post by:
See http://services.ccagroup.co.uk/testform.htm Looks as intended in firefox, is valid (bulk of inputs centred in a div occupying the left half of the page). ie ignores the child selector,...
8
by: sajid | last post by:
The CSS 2.1 Specification describes how to sort a list of selectors in order of specificity, but it doesn't provide a method to calculate the specificity of a single selector in isolation. I've...
1
by: jorgedec | last post by:
I have two test vertical menus. If I apply a border-bottom using a selecter of div.vbar a It looks fine. If I apply the border-bottom using a selecter of div.vbar ul li a
6
by: _googlepost | last post by:
I have some CSS that goes something like this: table.TableStyle {font-family: "Helvetica", "Ariel"; background- color:white; border-collapse:collapse;} table.TableStyle COLGROUP { background-...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.