473,386 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Overriding styles

How can i override all the styles being cascaded applied to some HTML
element?

For example:
I have a stylesheet where DIV styles are described
DIV {
padding: 10;
margin: 10;
}

and have HTML code:

<DIV><DIV style="override:all">Test</DIV></DIV>

I would like to not have the inner DIV padding, margin and other
directives described in styles above. Actually I would like to
discover some directive line "override:all"!

Please help me findning solution.

Jul 23 '05 #1
2 1924
Sergey Ilinsky wrote:
How can i override all the styles being cascaded applied to some HTML
element?
By *explicitly* setting different styles.
I have a stylesheet where DIV styles are described
DIV {
padding: 10;
margin: 10;
}
Which is meaningless as non-zero lengths *must* have units. Some browsers
will perform error recovery on that, but not all will.
and have HTML code:

<DIV><DIV style="override:all">Test</DIV></DIV>
There is no "override" property in CSS. So that is also meaningless.
I would like to not have the inner DIV padding, margin and other
directives described in styles above. Actually I would like to
discover some directive line "override:all"!


No such property exists.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 23 '05 #2
"David Dorward" <do*****@yahoo.com> wrote in message
news:d0*******************@news.demon.co.uk...
Sergey Ilinsky wrote:
How can i override all the styles being cascaded applied to some HTML
element?


By *explicitly* setting different styles.


Or create a class for the attributes you want, then don't include that
class on the elements for which you want the default behaviour. This
keeps you from having to determine what the default CSS values are and
setting a class with those styles.
I would like to not have the inner DIV padding, margin and other
directives described in styles above. Actually I would like to
discover some directive line "override:all"!


No such property exists.


Which is why I'd do it something like this:

<style type="text/css">
div.paddedWithMargin {
padding: 10px; margin: 10px;
}
</style>
<div>This will have the default padding and margin values</div>
<div class="paddedWithMargin">This will have your custom padding and
margin values</div>

Adding a class to every -div- on the page can be a bit cumbersome if you
want every -div- to have the custom CSS style except for one. To fix
that, you could use something like:

<style type="text/css">
div.paddedWithMargin div {
padding: 10px; margin: 10px;
}
</style>
<div>This will have the default padding and margin values</div>
<div class="paddedWithMargin">
<div>This will have your custom padding and margin values</div>
<div>This will have your custom padding and margin values</div>
<div>This will have your custom padding and margin values</div>
<div>This will have your custom padding and margin values</div>
</div>

Anyway, what does any of this have to do with JavaScript?

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ali Eghtebas | last post by:
Hi, I have 3 questions regarding the code below: 1) Why can't I trap the KEYDOWN while I can trap KEYUP? 2) Is it correct that I use Return True within the IF-Statement? (I've already read...
0
by: Quinton | last post by:
I'm running a website that uses CSS to format the text and a CGI program Coranto that icludes news updates via SSI. My problem is that some parts of the CSS don't seem to take effect on the...
2
by: Anna | last post by:
Hi all. I want to create a noframes version of a certain page (not written by me), that has three frames, each loading a page with few external stylesheets. If I copy the content of each...
3
by: Michael J. Hudson | last post by:
I'm not sure what good attaching a stylesheet to a Microsoft Word document does. When you save the document as an HTML file, Word throws in all of its style and font settings into the HTML file...
12
by: dan.vendel | last post by:
Hi, I know nothing about javascript, but quite a lot about regulat html and CSS. Have bumped into a problem that people in this fine congregation perhaps can help me with. I'm making a...
3
by: Amin Sobati | last post by:
Hi, I have two classes. Class2 inhertis Class1: ----------------------------- Public Class Class1 Public Overridable Sub MySub() End Sub End Class Public Class Class2
2
by: Randall Arnold | last post by:
I've written an app in VB.NET 2005 Beta that monitors temperature of several devices. I am using the ProgressBar for visual indication of temperature; all readings in expected range cause the bar...
3
by: Iain | last post by:
I'm writing a server control which is a navigation bar. My prototype uses id based styles to control the layout and dynamics. Is there any way I can override asp.net's processing of the ID so...
10
by: r035198x | last post by:
The Object class has five non final methods namely equals, hashCode, toString, clone, and finalize. These were designed to be overridden according to specific general contracts. Other classes that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.