I have a css file that defines style for all <p> tags.
like this
p { ......... }
How can I write a <p> in a page where the stylesheet is included that has default styling?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There’s no easy way to do this.
There a some common tricks to simulate that behavior though. The best one to use would vary based on how complex the overridden region is, and how often you want to do this.
Method 1 (for simple overrides):
Add an extra class definition in the statement similar to the one where you clear the default styling (such as is discussed at http://www.wordpress.darfuria.com/blog/clear-css-defaults). You might have to arrange the declarations carefully to prevent the ‘normal’ style from taking precedence.
Method 2 (clunky, but good for complex regions):
Use an iframe to pull the whole region from a separate .html file hosted elsewhere on your site. The content inside iframes respects the CSS of the page inside the frame, and generally ignores the CSS from the surrounding page.
Method 3 (good for one-shot overrides):
Use inline styles, as others have described here.
Edit:
Not Really a Method, But Probably The Most Correct Way
Also probably not what you want to hear
Re-think your how you’ve arranged your classes.
For example:
If the overridden
<p>is special in some way, it probably deserves it’s own class that describes what it’s purpose is.<p class='override'>doesn’t help people who will be looking at your design after you’re done, since it doesn’t tell them what the overridden text is for or why it’s styled that way.Are the overrides coming in a specific region? If so, them a style definition like
div.left_nav p {/*styles*/}might be a better fit.Lastly, Is your default
<p>styling not really default? Maybe a more loosely specified p style might be in order, with additionalp.fooandp.bardefinitions later on.This doesn’t fix your immediate problem, but it might be worth chewing on before you start your next project.