473,569 Members | 2,601 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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:a ll"!

Please help me findning solution.

Jul 23 '05 #1
2 1931
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:a ll"!


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******** ***********@new s.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:a ll"!


No such property exists.


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

<style type="text/css">
div.paddedWithM argin {
padding: 10px; margin: 10px;
}
</style>
<div>This will have the default padding and margin values</div>
<div class="paddedWi thMargin">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.paddedWithM argin div {
padding: 10px; margin: 10px;
}
</style>
<div>This will have the default padding and margin values</div>
<div class="paddedWi thMargin">
<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*****@agrico reunited.com>
comp.lang.javas cript 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
4172
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 the documentation but it is rather hard to understand so please don't refer to it :) 3) Many examples in the newsgroups use Return...
0
1977
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 included news. All four link styles are used, and all four work in the included text files. The text styles, on the other hand, seem not to work at all....
2
1740
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 framed page into a div on the noframes page, and put all the external links to stylesheets in the head, different styles
3
2573
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 AND these settings override the same properties you may have specified in your stylesheet. So, what good is it to attach a stylesheet???? I've...
12
2549
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 webshop. When user eventually ends up at the credit card processor's secure pages, the styles are quite different from the actual site's. I have managed...
3
1527
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
3728
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 to be blue continuous and when that threshold is exceeded the bar turns red continuous. This worked fine in Windows 2000. However, when I bring...
3
1808
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 that the ID will be the one I want regardless of the containing page and so on? Iain -- Iain Downs (DirectShow MVP)
10
105083
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 make use of these methods assume that the methods obey these contracts so it is necessary to ensure that if your classes override these methods, they...
0
7615
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8130
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7677
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
940
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.