Change link colour of content inside a div

HTML, CSS and anything else that deals with client side capabilities.

Moderator: General Moderators

Post Reply
davidhopkins
Forum Commoner
Posts: 41
Joined: Thu Jun 10, 2010 7:52 am

Change link colour of content inside a div

Post by davidhopkins »

Hello all,

I have a div container like this

Code: Select all

<a href="#"><div class="CompanyHolder CompanyHolderLeft">
                	<div class="CompanyHolderTitle">Vybe Media</div>
                    <div class="CompanyHolderInfo">Website : http://www.vybemedia.co.uk</div>
                    <div class="CompanyHolderInfo">Phone : 01495 751391</div>
                    <div class="CompanyHolderInfo">Email : info@vybemedia.co.uk</div>
                </div></a>
which has been wrapped around a link so that you can click anywhere on the container to view more information. However the text has now changed to blue, as its a link and i can seem to change its colour.

I have tried this in my css

.CompanyHolderTitle a {color:#000000}
.CompanyHolder a {color:#000000}

but it dosent seem to change

Can anyone help please?

My css looks like

Code: Select all

.CompanyHolder {
	width:280px;
	overflow:auto;
	border:1px solid #DDDDDD;
	border-radius:10px;
	background:#F3F7F9;
	margin-bottom:10px;
	padding:10px;
	font-family:Tahoma, Geneva, sans-serif;
	text-shadow: 0 1px 0 white;
}
.CompanyHolderTitle {
	width:100%;
	font-size:14px;
	font-weight: bold;
}
.CompanyHolderInfo {
	margin:5px 0 0 10px;
}
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Change link colour of content inside a div

Post by Celauran »

davidhopkins wrote:I have tried this in my css

.CompanyHolderTitle a {color:#000000}
.CompanyHolder a {color:#000000}

but it dosent seem to change
That's because the anchor isn't inside the .CompanyHolder div, but the other way around.

Code: Select all

a .CompanyHolder
{
    color: #000;
}
Post Reply