tags:

views:

65

answers:

2

Hello!

I am stuck on the CSS part, am helping a friend to implement one thing on her webpage. Its a dropdown menu and i got everything working the way i want it to. My problem is that it moves itself to the beginning of the row?

http://gazet.se/TestPages/Test.aspx

How do i get it to be centered?

(I have removed the code that has been solved to reduce the size)

A: 

The menu is floated block element, while the element around it are inline elements, which basicly can't mix. You need to either have all elements in #header_menu to also float, or let the menu be inline, too. (However I'm not sure, the latter would work).

RoToRa
+1  A: 

The menu has an id called #jsddm

#jsddm {
float:left;
margin:0;
padding:0;
}

Remove float left - that is first step. Second thing you should put the menu all in one list with sublevels as nested lists and get rid of img separators - they can be added as background images trough css. I suggest you create a new structure for your menu. Heres a nice article explaining it http://www.alistapart.com/articles/dropdowns/

Basically all you have to do is add additional <li> elements to #jsdm and move all menu links inside it.

easwee
Thats better, but how can i add the separator images? and get it centered?
Patrick
Also, there are some cracks in the line above?
Patrick
You can add them as a background image for list items. #jsdm li {background:url(separator.gif) no-repeat center right;} and for the last item that does not need a separator just add a class on li called "no_separator" or something like that so it resets and looks like .no_separator {background-image:none;} in css.
easwee
Everything works except that it is centered, how can i get it centered again?
Patrick
If you have a fixed width on menu you could add a margin:0 auto; if not you have to change display:inline on ul ,li and a but take care to not override second level of the menu (dropdown part).
easwee
I tried the margin 0 but with no result.
Patrick
#jsddm {display:inline;text-align:center}, #jsddm li {display:inline;float:none;}, #jsddm li a {display:inline} - this will make it centered, BUT then you have to set everything back for second level dropdown (starting from #jsddm li ul).
easwee