Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > Re: Optgroup </optgroup> and display: none style ...

Thread Tools

Re: Optgroup </optgroup> and display: none style ...

Jukka K. Korpela
Posts: n/a
Koteczek wrote:

> <optgroup label="ABCDEF" style="display: none;" id="hidden">
> <option ....>something 1</option>
> <option ....>something 2</option>
> </optgroup>
> ....
> </select>
> And the problem is as follows:
> FireFox = correct rendering, ABCDEF does not show up - it is hidden
> by 'display none' is't it?

Since you declare the _element_ <optgroup> to have display: none, it should
not be displayed, by CSS specifications, when your style sheet is applied.
The <option> elements are subelements of <optgroup>, so they should not be
displayed either, and any declaration for them cannot override this; see

So Firefox is wrong if it does what you say. I'm too lazy to check this,
especially since you didn't post a URL.

> M$ Explorer = displays this optgroup like others, it does not respect
> display none style at all, like the style was not there!

Such things may happen. Remember the usual CSS Caveats.

> Opera 9.6 = does not display <options> within the optgroup but
> "empty" optgroup IS being displayed. I hide optgroup and its content
> not only the content! That is crazy....

Crazy it may be - you haven't described what you are really doing and
haven't included a URL - but Opera's behavior, if described correctly here,
would be closest to the specs of the three, though not conformant.

> I must have it like the code = this one optgroup must be hidden and I
> display it when I want via JavaScript.

Then you need to gain totalitarian control over the world so that you can
force everyone to browse with both CSS and JavaScript support enabled.


Reply With Quote
Ari Heino
Posts: n/a
Koteczek kirjoitti seuraavasti:
> I DO NOT want this optgroup to be visible to the user when he loads the
> page.
> I want to display these options only when certain JS event happens.

I tested your code. Have you noticed that though the last option is not
visible, you can still select it with arrow keys (in FF also)?
I don't know is that a new problem for you. The display: none doesn't
make it non-existent to any browser. Maybe you know this already, just
making sure.
To the given problem, I have no ideas. I'm not an expert.

Reply With Quote

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
DataGrid - BorderStyle="None" and BorderWidth="None" doesn't work for Firefox David Freeman ASP .Net 8 02-16-2011 11:03 AM
Re: Optgroup </optgroup> and display: none style ... Adrienne Boswell HTML 8 10-17-2008 11:07 PM
Re: Optgroup </optgroup> and display: none style ... Bergamot HTML 0 10-10-2008 02:51 PM
Is there a built-in method for transforming (1,None,"Hello!") to 1,None,"Hello!"? Daniel Crespo Python 5 11-13-2005 12:52 PM
DataGrid - BorderStyle="None" and BorderWidth="None" doesn't work for Firefox David Freeman ASP .Net Web Controls 5 12-27-2004 05:27 AM