473,386 Members | 1,609 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.

Reset/unset css properties

I have a situation where the css is coming from an external template
and I only have control after it has done its thing. One of the things
it does is set text-align of all html table fields (td, tr, th) to be
left. What this means is that even when my HTML explicitly specifies
<td align="center">, the entry displays left aligned.

Is there any way to unset or set back to default a css property? This
could give me a way to ignore the template's css for those particular
items so the code in my html would get priority. Thanks in advance.

Khan

Jul 30 '07 #1
6 20173
ch*****@my-deja.com wrote:
Is there any way to unset or set back to default a css property? [...]
There is, but it unfortunately it cannot be done automatically. You
have to set every property back to its supposed value manually, usually
the initial value as defined in the CSS specifications (current is CSS
2.1 [1]). The "!important" modifier would then come in handy to
override any selector in the template stylesheet with a higher
specificity. We use this approach with Plone 2.1.2 and it works OK.

Firebug's CSS inspector and, until recently, CSSVista (for IE, requires
..NET 2.0) help much to see what properties were declared by the template
stylesheet.
HTH

PointedEars
___________
[1] http://www.w3.org/TR/CSS21
Jul 30 '07 #2
On 2007-07-30, ch*****@my-deja.com <ch*****@my-deja.comwrote:
I have a situation where the css is coming from an external template
and I only have control after it has done its thing. One of the things
it does is set text-align of all html table fields (td, tr, th) to be
left. What this means is that even when my HTML explicitly specifies
<td align="center">, the entry displays left aligned.

Is there any way to unset or set back to default a css property?
You might have more luck with style="text-align: center" rather than
using the deprecated attribute align="center"

Generally things in the style attribute will override things coming from
stylesheets. What happens with styles generated from other deprecated
attributes, like align, which is how deprecated attributes are
normally/probably handled these days, is more of a grey area.
Jul 30 '07 #3
Thomas 'PointedEars' Lahn wrote:
ch*****@my-deja.com wrote:
>Is there any way to unset or set back to default a css property? [...]

There is, but it unfortunately it cannot be done automatically. You
have to set every property back to its supposed value manually, usually
the initial value as defined in the CSS specifications (current is CSS
2.1 [1]). The "!important" modifier would then come in handy to
override any selector in the template stylesheet with a higher
specificity. We use this approach with Plone 2.1.2 and it works OK.

Firebug's CSS inspector and, until recently, CSSVista (for IE, requires
.NET 2.0) help much to see what properties were declared by the template
stylesheet.
HTH

PointedEars
___________
[1] http://www.w3.org/TR/CSS21
Perhaps I'm wrong, but doesn't IE botch '!important'? I've learned not
to rely on it for that reason. However, if Kahn is looking for just a
fix to the td centering, that shouldn't matter, AFAICS. It sounds like
the template is just defining td without any specificity, so a simple
td{text-align:center} counterpunch in his stylesheet should fix it. I
think.
Jul 30 '07 #4
Jason Priem meinte:
Perhaps I'm wrong, but doesn't IE botch '!important'? I've learned not
to rely on it for that reason.
IE6 does. At least where I used it to accomodate simple browser specific
styles.

Gregor
--
http://www.gregorkofler.at ::: Landschafts- und Reisefotografie
http://www.licht-blick.at ::: Forum für Multivisionsvorträge
http://www.image2d.com ::: Bildagentur für den alpinen Raum
Jul 30 '07 #5
On 30 Jul, 15:13, chen...@my-deja.com wrote:
What this means is that even when my HTML explicitly specifies
<td align="center">, the entry displays left aligned.

Is there any way to unset or set back to default a css property?
<td style="text-align: zig-zag-vertically;" >

Inline styles on the element have higher specificity in the cascade
than rules from the stylesheet.

Jul 31 '07 #6
Gregor Kofler wrote:
Jason Priem meinte:
>Perhaps I'm wrong, but doesn't IE botch '!important'? I've learned not
to rely on it for that reason.

IE6 does. At least where I used it to accomodate simple browser specific
styles.
It does not. If it did, how come that the !important declarations set
the corresponding property value in our code and those without it did not?
PointedEars
Aug 2 '07 #7

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

Similar topics

7
by: lawrence | last post by:
Given a bunch of mixes variables, I'm in a situation where I can't know what type they are. Can I use unset to kill an object? unset($object); Can I use unset to kill a pointer to an open...
3
by: Phil Powell | last post by:
PHP: unset($_SESSION); In my original environment (PHP 4.3.2) this line will delete the session variable 'mainDisplay'. But in the testing environment (PHP 4.3.6) the variable persists even...
21
by: steve | last post by:
Dont’ make my mistake. It is costly. Say you have defined a variable $var in your main script. Now in a function you access it using: global $var; But you want to set it to null inside the...
3
by: Dave Girvitz | last post by:
I have a PropertyGrid (Windows Forms App) based component that uses TypeConverters to generate ranges of acceptable values for properties. The idea was that I could download the key/value pairs...
7
by: fasanay | last post by:
Hi everybody I have got the following PHP code which I am trying to convert to ASP any help will be appreciated...I have done most of it but I cant find a replace function for Unset in asp which...
4
by: Lee Chapman | last post by:
Hi, Can anyone tell me why in the code below, the call to ClearChildViewState() has no effect? To paraphrase the code: I'm using view state. I have a textbox and a submit button (and a label...
2
by: Ron | last post by:
Hello, the following sub (below) reads an excel file to a webpage using BinaryReader. If anyone tries to modify the excel file from the browser this places the excel file in ReadOnly mode, and...
7
by: lievendp | last post by:
Just wondering, Is it possible for an instance of a class to unset itself? can I do "unset($this)" or "unset(&$this)" regards, Lieven http://eye.cc php newsgroups
0
Airslash
by: Airslash | last post by:
Hello, I've written a small function to delete a variable from a class' internal array. The variables on their own are custom class objects, and I'm a bit confused about the whole pass by...
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: 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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
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...

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.