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
Solved

Canceling earlier css script

Posted on 2013-11-27
5
169 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
Why a span is lower 2 26
CSS: Making Pure CSS read more boxes thinner 5 41
How to create a textarea which saves text in HTML 8 47
Insert Button on a table 16 37
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
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 …

856 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