Solved

Help overriding CSS stylesheet style

Posted on 2014-11-06
1
169 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses four methods for overlaying images in a container on a web page
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?
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

730 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