HighDots Forums  

Select. Hierarchy.

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


Discuss Select. Hierarchy. in the Cascading Style Sheets forum.



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

Default Select. Hierarchy. - 06-22-2008 , 09:20 PM






Hello,

I want to display, in a select, a few items but having between
themselves an hierarchy like a tree view.
I want to push a few of them a little bit forward then others ... I
will have three levels.

What is the best way to do this?

Thanks,
Miguel

Reply With Quote
  #2  
Old   
Joshua Cranmer
 
Posts: n/a

Default Re: Select. Hierarchy. - 06-22-2008 , 09:44 PM






shapper wrote:
Quote:
Hello,

I want to display, in a select, a few items but having between
themselves an hierarchy like a tree view.
I want to push a few of them a little bit forward then others ... I
will have three levels.

What is the best way to do this?
I think something like:
<select>
<optgroup label="2008">
<option value="2008Q1">Q1</option>
<option value="2008Q2">Q2</option>
<option value="2008Q3">Q3</option>
<option value="2008Q4">Q4</option>
</optgroup>
<optgroup label="2007">
<option value="2007Q1">Q1</option>
<option value="2007Q2">Q2</option>
<option value="2007Q3">Q3</option>
<option value="2007Q4">Q4</option>
</optgroup>
</select>

should due the trick.

--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth


Reply With Quote
  #3  
Old   
Johannes Koch
 
Posts: n/a

Default Re: Select. Hierarchy. - 06-23-2008 , 03:34 AM



Joshua Cranmer schrieb:
Quote:
shapper wrote:
I
will have three levels.

I think something like:
select
optgroup label="2008"
option value="2008Q1">Q1</option
optgroup-option is only two-level.

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)


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

Default Re: Select. Hierarchy. - 06-23-2008 , 10:44 AM



Johannes Koch wrote:
Quote:
Joshua Cranmer schrieb:
shapper wrote:
I
will have three levels.

I think something like:
select
optgroup label="2008"
option value="2008Q1">Q1</option

optgroup-option is only two-level.


Gecko only...

option { padding: 0; }
option.level1 { padding-left: 1em; }
option.level2 { padding-left: 2em; }
option.level3 { padding-left: 3em; }



<select>
<option class="level0">At level 0</option>
<option class="level0">At level 0</option>
<option class="level1">At level 1</option>
<option class="level2">At level 2</option>
<option class="level2">At level 2</option>
<option class="level3">At level 3</option>
<option class="level1">At level 1</option>
<option class="level1">At level 1</option>
<option class="level0">At level 0</option>
<option class="level1">At level 1</option>
</select>


--
Take care,

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


Reply With Quote
  #5  
Old   
shapper
 
Posts: n/a

Default Re: Select. Hierarchy. - 06-23-2008 , 10:50 AM



On Jun 23, 3:44*pm, "Jonathan N. Little" <lws4... (AT) central (DOT) net> wrote:
Quote:
Johannes Koch wrote:
Joshua Cranmer schrieb:
shapper wrote:
I
will have three levels.

I think something like:
select
* <optgroup label="2008"
* * * <option value="2008Q1">Q1</option

optgroup-option is only two-level.

Gecko only...

option { padding: 0; }
option.level1 { padding-left: 1em; }
option.level2 { padding-left: 2em; }
option.level3 { padding-left: 3em; }

select
option class="level0">At level 0</option
option class="level0">At level 0</option
option class="level1">At level 1</option
option class="level2">At level 2</option
option class="level2">At level 2</option
option class="level3">At level 3</option
option class="level1">At level 1</option
option class="level1">At level 1</option
option class="level0">At level 0</option
option class="level1">At level 1</option
/select

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIOhttp://www.LittleWorksStudio.com
I know this is not the best solution but maybe adding one, two,
three, ... non breaking spaces before the value depending on the
level?

I found this in wordpress Category selector. It will work in all
browsers.

Thanks,
Miguel


Reply With Quote
  #6  
Old   
shapper
 
Posts: n/a

Default Re: Select. Hierarchy. - 06-23-2008 , 11:16 AM



On Jun 23, 3:44*pm, "Jonathan N. Little" <lws4... (AT) central (DOT) net> wrote:
Quote:
Johannes Koch wrote:
Joshua Cranmer schrieb:
shapper wrote:
I
will have three levels.

I think something like:
select
* <optgroup label="2008"
* * * <option value="2008Q1">Q1</option

optgroup-option is only two-level.

Gecko only...

option { padding: 0; }
option.level1 { padding-left: 1em; }
option.level2 { padding-left: 2em; }
option.level3 { padding-left: 3em; }

select
option class="level0">At level 0</option
option class="level0">At level 0</option
option class="level1">At level 1</option
option class="level2">At level 2</option
option class="level2">At level 2</option
option class="level3">At level 3</option
option class="level1">At level 1</option
option class="level1">At level 1</option
option class="level0">At level 0</option
option class="level1">At level 1</option
/select

--
Take care,

Jonathan
-------------------
LITTLE WORKS STUDIOhttp://www.LittleWorksStudio.com
I know this is not the best solution but maybe adding one, two,
three, ... non breaking spaces before the value depending on the
level?

I found this in wordpress Category selector. It will work in all
browsers.

Thanks,
Miguel


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.