Forum Moderators: not2easy

Message Too Old, No Replies

Tableless Drop Down Menu

CSS Only, No JavaScript

         

hexdj

3:21 am on Sep 26, 2006 (gmt 0)

10+ Year Member




I have a site with a menu that needs a couple of sub-menus and I found this code on some site but the sub-menus have tables inside the UL and LI tags and I have noticed a few times that when I load my site it first loads all the content of my UL and it does not load any styles until the whole UL is loaded

Is it possible that the tables are causing a slow drop-down menu?

Is there any tableless CSS drop down? thank you.

sodani

5:03 am on Sep 26, 2006 (gmt 0)

10+ Year Member



There is no reason why you should be using tables as part of a dropdown. Try this code:
<select name="fieldname" class="menu" id="mymenu" >
<option value="1">option 1</option>
<option value="2">option 2</option>
<option value="2">option 2</option>
</select>

hexdj

6:59 am on Sep 26, 2006 (gmt 0)

10+ Year Member



but isn't the SELECT tag for forms rather than making a navigation menu for my site?

stever

9:01 am on Sep 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>Is there any tableless CSS drop down?

Yes, of course. There are thousands of sites using them and hundreds of sites offering sample code, as you will see using your phrase above to search your favourite engine.

Your tables shouldn't be affecting the display (although validate your code) but if you are using an external style sheet it may be loading slowly for some reason?

Marcia

10:04 am on Sep 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What if you want drop down menus across a top navbar for several categories? Like

Coffee ¦ Tea ¦ Soda

with options for things like decaf, flavored, herb tea, cola, root beer, etc., having a few options under each category. Would it take a separate div id= for each of the categories?

Setek

10:19 am on Sep 26, 2006 (gmt 0)

10+ Year Member



but isn't the SELECT tag for forms rather than making a navigation menu for my site?

That's exactly right,

select
is for forms.

Is there any tableless CSS drop down

You can have tableless navigation, you can achieve this with CSS, but you'll have to incorporate a little javascript.

As for the CSS part itself, you can search on Google for css dropdown.

hexdj

5:08 pm on Sep 26, 2006 (gmt 0)

10+ Year Member



Well I guess I will need to get back to using JavaScript since stupid IE isn't fully CSS compatible (as always).

Thanks guys.

SuzyUK

5:26 pm on Sep 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Would it take a separate div id= for each of the categories?

No, at least not unless you actually want to format each dropdown differently (say color or background image icons)

you can target sublists of lists just by using the main parent list ID and specificity