How can I make an include unaffected by style/CSS?

78 views Asked by At

I'm trying to make an alert banner at the top of everyones screen on a website, but I have too many php files so it'd be hard to go through and change the alert via code on every single one of them.

Whenever I went to include this alert banner into every site, I realized it followed the style file of that and instead centered the alert banner.

How will I make it unaffected?

1

There are 1 answers

0
Lance On

Give your alert banner its own styles, placed inline with the elements. These styles will take precedence over your style sheets.

As you can see here, the inline style is used for the div and the style sheet style is ignored.

div { border: 5px dashed blue; }
<div style="border: 1px solid red;">I'm a div</div>