HighDots Forums  

table-cell

Cascading Style Sheets Layout/presentation on the WWW (comp.infosystems.www.authoring.stylesheets)


Discuss table-cell in the Cascading Style Sheets forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Jeff
 
Posts: n/a

Default table-cell - 11-25-2008 , 10:22 PM






I'd like to turn on and off table cells so I can display differening
data.

.some_row_class{
display: none;
}

.some_row_class{
display: table-cell;
}

Now that works fine in FireFox, but IE 6 chokes.

display: block works in IE and fails in Firefox.

Is there a reasonably reliable way to get around this. My alternative
is a lot of ifs...

Jeff

Reply With Quote
  #2  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: table-cell - 11-26-2008 , 04:42 PM






Jeff wrote:

Quote:
I'd like to turn on and off table cells so I can display differening
data.
Since you are apparently doing this with client-side scripting (why else
would you ask?), why don't you simply manipulate the document tree? If you
depend on client-side scripting for some functionality, why would you _also_
depend on CSS support being enabled?

Quote:
.some_row_class{
display: none;
}
Your text and your heading refer to cells, but your dummy class name
suggests that this is about rows.

Quote:
.some_row_class{
display: table-cell;
}
IE does not support any of the display property values that start with
"table-".

However, if you really want to make yourself dependent on CSS as well as
scripting, why don't you use just the first one of the rules and dynamically
change the class property of a cell or row to "some_row_class" or to
something else, depending on whether you want it to be displayed or not?

--
Yucca, http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #3  
Old   
Jeff
 
Posts: n/a

Default Re: table-cell - 11-26-2008 , 05:31 PM



Jukka K. Korpela wrote:
Quote:
Jeff wrote:

I'd like to turn on and off table cells so I can display differening
data.

Since you are apparently doing this with client-side scripting (why else
would you ask?), why don't you simply manipulate the document tree?
Server side in this case. And, I've never found manipulating the DOM
tree to be simple. That's a bit of code to extract data from a table and
then rebuild it and it's contents and attributes.

If
Quote:
you depend on client-side scripting for some functionality, why would
you _also_ depend on CSS support being enabled?

.some_row_class{
display: none;
}
Who turns that off?
Quote:
Your text and your heading refer to cells, but your dummy class name
suggests that this is about rows.

.some_row_class{
display: table-cell;
}
<td>, I'm not actually using a class to call them.
Quote:
IE does not support any of the display property values that start with
"table-".

However, if you really want to make yourself dependent on CSS as well as
scripting, why don't you use just the first one of the rules and
dynamically change the class property of a cell or row to
"some_row_class" or to something else, depending on whether you want it
to be displayed or not?
I think instead of turning on what I wanted, I'll turn off what I don't.

Is there a way to set an "element" back to it's default? Such as
unsetting a width or in this case or display in this case. I can't find it.

Jeff
Quote:

Reply With Quote
  #4  
Old   
Thomas Mlynarczyk
 
Posts: n/a

Default Re: table-cell - 11-26-2008 , 05:31 PM



Jeff schrieb:

[display: table-cell]
Quote:
Now that works fine in FireFox, but IE 6 chokes.
display: block works in IE and fails in Firefox.
There are a number of things that IE "handles" differently from real
browsers. The best way to deal with this is:

1) Use a doctype triggering strict mode in IE
2) Code your CSS for standards compliant browsers
3) Use a conditional comment to feed an additional stylesheet with IE
specific fixes to all versions of IE
4) Within that stylesheet, use CSS hacks to address specific versions of
IE where necessary
5) Code the necessary fixes without needing to worry about breaking
anything in other browsers - you can even use any Microsoft proprietary stuff
you want, as this extra stylesheet is loaded only by IE

Example:
http://www.mlynarczyk-webdesign.de/ng/three-columns-layout/

Strict mode, CSS hacks, conditional comments:
http://www.quirksmode.org/css/contents.html

IE bugs and quirks with fixes:
http://www.positioniseverything.net/explorer.html

Greetings,
Thomas

--
Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison!
(Coluche)


Reply With Quote
  #5  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: table-cell - 11-27-2008 , 01:31 PM



Jeff wrote:

Quote:
Since you are apparently doing this with client-side scripting (why
else would you ask?), why don't you simply manipulate the document
tree?

Server side in this case.
So why don't you generate the proper _content_ server-side then? Why not
make the server send an HTML document that just contains the elements you
want there??

Quote:
.some_row_class{
display: none;
}

Who turns that off?
Huh? Your questions are obscure. You don't quote my proposal, just a random
fragment thereof. There is no reason to "turn that off", if you simply
remove an element from class "some_row_class" when desired.

Quote:
td>, I'm not actually using a class to call them.
So nothing you have written describes what you are actually doing, right?

Quote:
However, if you really want to make yourself dependent on CSS as
well as scripting, why don't you use just the first one of the rules
and dynamically change the class property of a cell or row to
"some_row_class" or to something else, depending on whether you want
it to be displayed or not?

I think instead of turning on what I wanted, I'll turn off what I
don't.
Whatever. That really doesn't matter in the approach I suggested.

Quote:
Is there a way to set an "element" back to it's default?
No. Don't look for an answer in the wrong direction. Don't dig any deeper.

--
Yucca, http://www.cs.tut.fi/~jkorpela/



Reply With Quote
  #6  
Old   
phil-news-nospam@ipal.net
 
Posts: n/a

Default Re: table-cell - 11-28-2008 , 05:02 PM



On Wed, 26 Nov 2008 17:31:16 -0500 Jeff <jeff (AT) spam_me_not (DOT) com> wrote:

Quote:
Server side in this case. And, I've never found manipulating the DOM
tree to be simple. That's a bit of code to extract data from a table and
then rebuild it and it's contents and attributes.
You can take elements out of the tree and keep their references in a
variable, then add them back later. You can also recursively clone an
element and all its contents, and tweak them to a varying state. Then
you simply swap between those elements for your changing content.


Quote:
Is there a way to set an "element" back to it's default? Such as
unsetting a width or in this case or display in this case. I can't find it.
Have another document element not in the tree, cloned from the initial part
of the tree as delivered in the original document, modified to have varied
content, and just swap between them when desired.

--
Quote:
WARNING: Due to extreme spam, googlegroups.com is blocked. Due to ignorance |
by the abuse department, bellsouth.net is blocked. If you post to |
Usenet from these places, find another Usenet provider ASAP. |
Phil Howard KA9WGN (email for humans: first name in lower case at ipal.net) |

Reply With Quote
  #7  
Old   
Ben C
 
Posts: n/a

Default Re: table-cell - 11-29-2008 , 08:05 AM



On 2008-11-28, phil-news-nospam (AT) ipal (DOT) net <phil-news-nospam (AT) ipal (DOT) net> wrote:
Quote:
On Wed, 26 Nov 2008 17:31:16 -0500 Jeff <jeff (AT) spam_me_not (DOT) com> wrote:
[...]
| Is there a way to set an "element" back to it's default? Such as
| unsetting a width or in this case or display in this case. I can't find it.

Have another document element not in the tree, cloned from the initial part
of the tree as delivered in the original document, modified to have varied
content, and just swap between them when desired.
That won't affect styles-- all the same selectors will just match the
node you swapped in.

Unless you put the styles in the style attribute, but then you might as
well reset that rather than replace the whole node with an earlier
clone.

To answer the original question, no you can't set style properties back
to their defaults. In CSS3 you can set them back to their initial values
(and some browsers may support this) by setting e.g. width: initial.

The initial value is defined for each property and is the same for all
elements. It's what you get in the absence of any stylesheets at all,
including the browser default stylesheet.


Reply With Quote
  #8  
Old   
Jonathan N. Little
 
Posts: n/a

Default Re: table-cell - 11-29-2008 , 10:10 AM



Ben C wrote:

Quote:
To answer the original question, no you can't set style properties back
to their defaults. In CSS3 you can set them back to their initial values
(and some browsers may support this) by setting e.g. width: initial.
No but in effect you can by nulling the property. See my example that
does work in poor IE...

http://message-id.net/%3C7197$492dd44f$40cba7cb$8060 (AT) NAXS (DOT) COM%3E
Message-ID.net : 7197$492dd44f$40cba7cb$8060 (AT) NAXS (DOT) COM


--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com


Reply With Quote
  #9  
Old   
Ben C
 
Posts: n/a

Default Re: table-cell - 11-29-2008 , 12:39 PM



On 2008-11-29, Jonathan N. Little <lws4art (AT) central (DOT) net> wrote:
Quote:
Ben C wrote:

To answer the original question, no you can't set style properties back
to their defaults. In CSS3 you can set them back to their initial values
(and some browsers may support this) by setting e.g. width: initial.

No but in effect you can by nulling the property. See my example that
does work in poor IE...

http://message-id.net/%3C7197$492dd44f$40cba7cb$8060 (AT) NAXS (DOT) COM%3E
Message-ID.net : 7197$492dd44f$40cba7cb$8060 (AT) NAXS (DOT) COM
There you're just removing it from the style attribute-- it will still
apply if it's in a CSS rule whose selector matches the element.

I think I did mention that. But in any case yes that might be a
perfectly good way for the OP to proceed.


Reply With Quote
  #10  
Old   
Jeff
 
Posts: n/a

Default Re: table-cell - 11-30-2008 , 01:05 AM



Ben C wrote:
Quote:
On 2008-11-29, Jonathan N. Little <lws4art (AT) central (DOT) net> wrote:
Ben C wrote:

To answer the original question, no you can't set style properties back
to their defaults. In CSS3 you can set them back to their initial values
(and some browsers may support this) by setting e.g. width: initial.
No but in effect you can by nulling the property. See my example that
does work in poor IE...

http://message-id.net/%3C7197$492dd44f$40cba7cb$8060 (AT) NAXS (DOT) COM%3E
Message-ID.net : 7197$492dd44f$40cba7cb$8060 (AT) NAXS (DOT) COM

There you're just removing it from the style attribute-- it will still
apply if it's in a CSS rule whose selector matches the element.
Sorry, I've been out of town...

It seems to me that if setting the style to empty works then it seems
like you should also be able to addRule/insertRule and set the css text
to empty.

I'm assuming you guys know about that, for those that don't,
something like this will add a rule to the end of your last stylesheet:

function addRule(selector,css_text){
var SS=document.styleSheets[document.styleSheets.length-1];
if (SS.addRule){
SS.addRule(selector,css_text)}
else{
SS.insertRule(selector+' {'+css_text+' }',SS.cssRules.length);
}
}

If you can find the rule number, you can also delete that rule. I've
never found that to be easy but that would seem to be the cool
javascript way to do this, at least until IE gets it's act together.

I'll test this all later when I have a bit more time. In the
meantime, thanks!

Jeff
Quote:
I think I did mention that. But in any case yes that might be a
perfectly good way for the OP to proceed.

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.