Solved

Canceling earlier css script

Posted on 2013-11-27
5
165 Views
Last Modified: 2013-11-28
If I wanted the following to be canceled what would the syntax be?

border: 2px solid #000;

border: none;
0
Comment
Question by:burnedfaceless
5 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39682718
You can't 'cancel' a CSS declaration but you can replace it.  CSS definitions are applied in the order that they are found on a page.  If you have a <style> section and a CSS file link in the <head>, the one that comes Last (for any particular element) is the one that is applied.  After that, any 'inline' 'style' attributes are applied.

Note that if you change the color with 'border-color', that's all that it changes.  The width and style remain the same until you change them.
0
 
LVL 13

Accepted Solution

by:
duncanb7 earned 250 total points
ID: 39682894
I think you want to control  CSS style in your page  for some html tags or area  individually
and effeciently. If so,

you might be interested in the following articles about CSS style precedence

http://www.vanseodesign.com/css/css-specificity-inheritance-cascaade/
http://css-tricks.com/specifics-on-css-specificity/
http://www.w3.org/TR/CSS2/cascade.html

Hope understand your question completely. If not please point it out

Duncan
0
 
LVL 17

Assisted Solution

by:nanharbison
nanharbison earned 250 total points
ID: 39683718
As DaveBaldwin says, f you replace the CSS for the border, it has to be the last CSS rule read by the page, so the style sheet that contains border:none has to come after the previous border rule.
But also, is your replacement rule in a separate style sheet, so you can look at the html on the page and make sure the replacement rule style sheet is last?
Or have you embedded this replacement rule in the html on one particular page, which comes after rules on a style sheet.? Or you can do it inline right in the div or whatever needs the replacement rule. That rule is the last one read.
0
 

Author Closing Comment

by:burnedfaceless
ID: 39684246
Thanks
0
 
LVL 13

Expert Comment

by:duncanb7
ID: 39684263
Thanks for your pt

Have a nice day

Duncan
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Wordpress theme to easily (hopefully!) make this type of site 1 37
CSS Scroll Issue 3 94
Autoprefixer and text editors 1 26
P tag not forcing line space 2 23
This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

861 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

26 Experts available now in Live!

Get 1:1 Help Now