Solved

Help overriding CSS stylesheet style

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

706 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now