简体   繁体   中英

Alter with an external CSS Stylesheet only a specific part of the HTML

I have an html document.

In the document I link an external CSS Stylesheet

<link rel="stylesheet" type="text/css" href="css/whatever.css" />

But this external CSS Stylesheet modifies all my HTML document.

I need the External CSS Stylesheet to modify only a specific section of the HTML document.

You can define the css inside the html document in two differents ways.

<style> //Your style </style>

or inline <tag style:"property:style;"></tag>

That's what classes are for if you want to style a specific part just wrap it in a div, give it a class and style it.

 p { color: red; } .specific p { color: blue; } 
 <div class="specific"> <p>Test</p> </div> <p>Test</p> <p>Test</p> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM