gunz_rozez
gunz_rozez

Reputation: 21

ignore css styles on certain type selectors

Say I have 2 sites, http://1.example.com, http://2.example.com.

My issue is this : I am to dynamically add content to 1.example.com and 2.example.com, as part of this dynamic content addition I need to download and apply a css file via javascript. Now there is a <hr> tag in my dynamic content I'd like to style. When I apply this on 1.example.com, all works fine, but when I try to apply it to 2.example.com, the issue is that 2.example.com has a stylesheet that already defines stylerules for the <hr> tag. Like say padding. I don't want to override the properties manually. Is there a way to ignore <hr> styles defined in 2.example.com for my dynamic content and only apply styles I downloaded?

Upvotes: 0

Views: 77

Answers (2)

Gopikrishna
Gopikrishna

Reputation: 857

Try like this,

You may find parent div in your dymanic content, For example: .parent-div hr{ your styles }

Upvotes: 0

bookcasey
bookcasey

Reputation: 40433

Be more specific. Learn about CSS specificity to override styles.

You could, for example, add a class to the <hr> and style that.

Upvotes: 1

Related Questions