# CSS not cooperating id selectors and links

**URL:** https://forum.kirupa.com/t/css-not-cooperating-id-selectors-and-links/63809
**Category:** web dev
**Created:** [September 10, 2004, 3:26am UTC](https://forum.kirupa.com/t/css-not-cooperating-id-selectors-and-links/63809 "2004-09-10T03:26:00Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![boristheblade](https://avatars.discourse-cdn.com/v4/letter/b/848f3c/32.png) [@boristheblade](https://forum.kirupa.com/u/boristheblade)
#### Post date: [September 10, 2004, 3:26am UTC](https://forum.kirupa.com/t/css-not-cooperating-id-selectors-and-links/63809/1 "2004-09-10T03:26:00Z")

</div>

I’m going nuts… I cannot figure out why my links are not showing up how I want them to. The navigation links show up like the CSS tells it to, but the “link 1” and “link 2” have a mind of their own. I do not understand why they are not listening to CSS. link 1 and link 2 should be red, then become underlined on hover. Also the Test link in the middle section displays differently in Firefox vs IE. Any help is greatly appreciated!!

[www.texasriptide.org](http://www.texasriptide.org)

[www.texasriptide.org/css/default.css](http://www.texasriptide.org/css/default.css)

here is the css for link1 and link2

```auto
#left div.profile{
	text-align:center;
}
#left div.profile a:link, a:visited {
	font-size: 90%;
	line-height: 140%;
	color:#CC0000;
	text-decoration: none;
}
#left div.profile a:hover {
	color:#CC0000;
	text-decoration: underline;
}
#left div.profile a:active {
	color:#CC0000;
	text-decoration: underline;
}

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 10, 2004, 4:01am UTC](https://forum.kirupa.com/t/css-not-cooperating-id-selectors-and-links/63809/2 "2004-09-10T04:01:51Z")

</div>

Why dont you simplify your css. Not sure why the left div stuff is there is you are only controlling a ahref tag.

```php

A {
regular link stuff here (default links)
}

A.hover {
regular link stuff here (default links)
}

A.visited {
regular link stuff here (default links)
}

A:profile {
profile link stuff here
}

A.hover:profile {
profile link stuff here
}

A.visied:profile {
profile link stuff here
}

```

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 10, 2004, 4:26am UTC](https://forum.kirupa.com/t/css-not-cooperating-id-selectors-and-links/63809/3 "2004-09-10T04:26:51Z")

</div>

Thanks, that works, but why doesnt my way. The reason I have the

```auto
#left div.profile

```

is so I can just do

```php
<div id="left">
<div class="profile">
<a href="x">Yadda</a>
<a href="x">Yadda</a>
<a href="x">Yadda</a>
</div>
</div>

```

instead of having to do

```php

<a href="x" class="profile">Yadda</a>
<a href="x" class="profile">Yadda</a>
<a href="x" class="profile">Yadda</a>

```

They both should accomplish the same thing in the end. I would still like to know why my way doesnt work.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 10, 2004, 4:35am UTC](https://forum.kirupa.com/t/css-not-cooperating-id-selectors-and-links/63809/4 "2004-09-10T04:35:00Z")

</div>

I dont think your first example will work in any case, since the ahref tag will break the cascade. You can accomplish what you are trying programmatically but not the way you are trying. Actually let me think on it. It is late and my brain is fried.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [September 10, 2004, 11:55am UTC](https://forum.kirupa.com/t/css-not-cooperating-id-selectors-and-links/63809/5 "2004-09-10T11:55:07Z")

</div>

Actually it does work. The section above that with the links "Home, Lessons, Teams … " was done using the same technique. Here is the CSS

```php
#left div.nav a:link, a:visited {
	display: block;
	font-size: 90%;
	font-weight:bold;
	line-height: 140%;
	color:#000066;
	text-decoration: none;
}
#left div.nav a:hover {
	color:#336699;
	background-color: #CCCCCC;
}

```

This is why it is frustrating me. This works but not the profile links. Thanks for your help DDD
