Solved

Help overriding CSS stylesheet style

Posted on 2014-11-06
1
173 Views
Last Modified: 2014-11-06
Greetings.  I am adding one section onto a website that is already in existence.  I do not want to modify any of the .CSS sheets that are in the main site, but I have linked to them so that I can benefit from the same styles.

However, in some situations I want to override these .css styles from the root site.   For instance, I want the text size (defined in the p tag on the main site) to be 12, but in the main root site, the size is 14.  No matter what I try, I can't seem to override this style.  I have a stylesheet used only in my section of the site, and when I try and redefine the <p> tag in this sheet, it continues to be overruled by the main sheet.  

Are there ideas of how I can best overrule the style?  At this point, I'm not concerned with best practices, but simply want this to work.  Thank you.
0
Comment
Question by:victoria franklin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 500 total points
ID: 40427112
Create a stylesheet for your specific page.  Then duplicate the rule declaration for the styles you have to override and put in the properties you need, then list the local stylesheet as the last one in the page.  The CSS parser overrides previous values for duplicate declarations and processes in source listing order.

This is not a best practice.  You should be consolidating the CSS; but it is a relatively risk-free hack.

Cd&
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question