Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-04-2012, 06:39 PM   PM User | #1
scheric1
New to the CF scene

 
Join Date: Dec 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
scheric1 is an unknown quantity at this point
override parent css

I am having trouble overriding padding and margin css on a class I have created for headers.

I would like to make all my h2 tags that I specify with a class to remove all padding and margin that is being inherited from the parent class.

https://www.icsworld.com/Find_Local_.../Missouri.aspx

Here is an example. Each of the H2 tags within the body content have received a class called .headerBlock

my headerBlock CSS is as follows
Code:
.headerBlock h2 {
	background: #FFFFCC;
	margin: 0 px;
	padding: 0 px;
	border-top: solid 1px #C0C0C0;
	border-bottom: solid 1px #C0C0C0;
	text-align: center;


}
However I think my css is being overwritten by the .PageText class.

My understanding is the child class needs to be more specific in order for it to override it's parent but I seem to be having trouble formatting the rule for it to properly generate.

Can someone point me in the right direction?

Thanks
scheric1 is offline   Reply With Quote
Old 12-04-2012, 08:06 PM   PM User | #2
tempz
Regular Coder

 
Join Date: Jul 2012
Location: London
Posts: 436
Thanks: 4
Thanked 80 Times in 80 Posts
tempz is an unknown quantity at this point
Where are you using h2? I can't seem to locate usage of h2.
tempz is offline   Reply With Quote
Old 12-04-2012, 08:23 PM   PM User | #3
tracknut
Regular Coder

 
Join Date: Aug 2006
Posts: 891
Thanks: 4
Thanked 205 Times in 204 Posts
tracknut is an unknown quantity at this point
The usage you're making of the class headerBlock is like this:
<h2 class="headerBlock">Missouri..... </h2>

So your CSS to control the style of that should look like:
h2.headerBlock {padding..... }

Coincidentally you have this style on line 430 of your style.css file, but you have not set the padding and what-not for that style.

Dave
tracknut is online now   Reply With Quote
Reply

Bookmarks

Tags
child, css, parent

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:06 AM.


Advertisement
Log in to turn off these ads.