[ciapug] Slightly OT: weird problems with CSS

Jonathan Bailey ciapug@cialug.org
Sat, 05 Mar 2005 07:52:02 -0600


I ended up figuring out how your example works fine.... Let me give 
another more specific example how that I've done a bit of research...

HTML:
<div class=menubox id=nav_domains></div>

JavaScript:
// Yes, this is how the JS acts.. It will set the display to block even 
if it already is...
var element = document.getElementById('nav_domains');
element.style.display = 'block';
element.innerHTML = 'whatever content';

Now, how the browser sees the above DIV tag after the JS is run on it....
<div class=menubox id=nav_domains style="display: block;">whatever 
content</div>

It seems that when I use 'element.style.display' that it sets the style 
within the DIV tag which overrides the CSS....


Jon


Chris Hettinger wrote:

> I duplicated this here:
> http://www.ch-freelance.com/css_exp/jb/
> Based on the little html and css you gave...
>
> When I went to print preview, both DIVs were no longer visible in both 
> Moz and IE6/Win. I believe that is your desired result?
>
> Any more detail on the issue?
>
> -ch
>
> jcbailey@code0.net wrote:
>
>> First, here is the HTML - next, the issue... (well, at least the 
>> relavent
>> stuff).
>>
>> page.htm:
>> <link rel=stylesheet type=text/css href=admin.css media=all>
>> <link rel=stylesheet type=text/css href=admin-print.css media=print>
>> <div class=menubox id=nav_domains>content</div>
>> <div class=menubox>content</div>
>>
>> admin.css:
>> .menubox {
>>         padding:        2px;
>>         width:          194px;
>>         margin-top:     10px;
>>         margin-bottom:  10px;
>>         border:         1px solid #b1b1b1;
>>         background:     #fff;
>>         font-family:    Sans-Serif;
>>         font-size:      10pt;
>> }
>>
>> admin-print.css:
>> .menubox { display: none; }
>>
>>
>> The issue is that when I switch to the print format, any DIVs with an ID
>> tag set don't disappear. The ones with no ID tag set disappear like they
>> should. Any ideas?
>>
>>
>>
>>
>> Jon
>>
>> _______________________________________________
>> ciapug mailing list
>> ciapug@cialug.org
>> http://cialug.org/mailman/listinfo/ciapug
>>
> _______________________________________________
> ciapug mailing list
> ciapug@cialug.org
> http://cialug.org/mailman/listinfo/ciapug
>