Solved

Help overriding CSS stylesheet style

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
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 …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

776 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