Previous Message
Next Message

Print CSS Expandable Menu buggy

Sent by James Denholm-Price on 11 July 2005 17:05


Hi Melissa & all@css-d,

On 7/11/05, Craddock, Melissa [EMAIL-REMOVED]> wrote:
> I am using a expanding menu based on
> http://www.gazingus.org/html/menuExpandable.html
>... I would like to have the menu print expanded even though it is collapsed
> on the screen.
> When I first go to the page, I can click on print preview and see the
> expanded menu even though it is collapsed on the screen. If I click on
> one of the items on the screen to expand and click on it again to
> collapse, that item will print collapsed. In my screen stylesheet I have
> the class set to display: none;. In the print stylesheet the display
> none is removed, yet it still doesn't print. 

I guess it's because the menu JS
<http://www.gazingus.org/js/menuExpandable3.js> (?) sets the element's
"style.display.block" properties to "none" to hide them then you click
.... this is hard to override in a print stylesheet as inline style
(which is what the DOM "style" property effectively manipulates) has a
high specificity
<http://css-discuss.incutio.com/?page=SelectorSpecificity>

You could try increasing the specificty of the print display rules by
adding "!IMPORTANT" or more specific selectors.

Ideally (IMO) we could rewrite the menu script to apply "show" and
"hide" classes to the elements and then all you need do is override
show and hide in the print style sheet but I appreciate this is
harder.

James

PS: Google reveals a nice Brainjar article
<http://www.brainjar.com/css/using/default4.asp>: that says

"Inline Styles

Style properties defined inline, i.e., within an HTML tag's STYLE
attribute, are given the same weight that an ID selector would have.
In terms of order, they are treated as though they occur after all
other rules.

In other words, inline styles take precedence over anything but a
conflicting declaration in a user style sheet."
______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
List wiki/FAQ -- http://css-discuss.incutio.com/
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread:

Possibly related: