473,799 Members | 2,988 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2797
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*********@hot mail.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.infosystem s.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:hov er { 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
6620
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" content="en" /> means the language is english <meta name="language" content="zh" /> means the language is Simplified Chinese. Then I use a css selector to define different style for each language. My css code is
2
3862
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, .clrDk and associated link colors using selectors. One of the aims is to ensure that matching text color, background, and link colors are maintained. These palettes are applied as multiple classes to various page modules which also have abstract...
25
11951
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 common notation for this. I wanted to avoid using an image, though, and this content rule works great!
1
2117
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(!): <h3>Title</h3>
0
3646
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 datagrid on the left side that lists names and perhaps a couple of other key fields. The user can click on a record in the datagrid, which should automatically pull up details on that record in the various text boxes and other controls on the right...
2
2150
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, positioning everything aligned left. I'm familiar with http://w3development.de/css/hide_css_from_browsers/ I thought the ie child selector bug only occurred where there were no spaces (parent>child) - I'd thought it worked when there were (parent >
8
2339
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 devised a method to do this, which I describe in the following article: http://calculating-css-selector-specificity.blogspot.com/ Comments and/or criticisms welcome.
1
1728
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
7197
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- color:lavender;} The second line is a style that is applied to a particular named COLGROUP element in tables assigned the TableStyle class. Unfortunately, while this works in most modern browsers (including
0
9686
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9540
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10250
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10222
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10026
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9068
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3757
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.