4 replies [Last post]
ccpp
ccpp's picture
User offline. Last seen 1 year 47 weeks ago. Offline
rank Regular
Regular
Timezone: GMT+1
Joined: 2008-03-17
Posts: 33
Points: 7

Hi all! I'm trying to restyle a website, and I created the whole layout. I need a top menu with dropdowns, I created it, but I have a problem in the visualization. In particular, the dropdown are not centered with respect to the menu, you can see an example here:
http://www.sagrantinoict.it/progetti/rs/
What I would like to have is that the dropdown menu are centered below the arrow that appears on mouse rollover.

Thanks

P.

Eric Watson
Eric Watson's picture
User offline. Last seen 1 year 33 weeks ago. Offline
rank Regular
Regular
Timezone: GMT-7
Joined: 2009-06-29
Posts: 15
Points: 11

That's a good one. Hmmm...

That's a good one. Hmmm... well this is how I would first try it. Assuming the sub ul is nested in the top level li, and the top level li is position relative, and the sub ul is position absolute... Give the sub ul and sub li width 100% and text-align center. Untested but that should work.

Eric Watson
Eric Watson's picture
User offline. Last seen 1 year 33 weeks ago. Offline
rank Regular
Regular
Timezone: GMT-7
Joined: 2009-06-29
Posts: 15
Points: 11

Hmmm,just tested that. It

Hmmm,just tested that. It works - it centers it. But I can't seem to get the padding right too. Maybe someone else can finish up...

ccpp
ccpp's picture
User offline. Last seen 1 year 47 weeks ago. Offline
rank Regular
Regular
Timezone: GMT+1
Joined: 2008-03-17
Posts: 33
Points: 7

Hi, are you sure you tested

Hi, are you sure you tested it? I tried setting width:100% but now the dropdown are smaller, they have the same size then the parent menu, but they can be bigger, so the text overflows. Could you check the page i linked above?

Thanks

ccpp
ccpp's picture
User offline. Last seen 1 year 47 weeks ago. Offline
rank Regular
Regular
Timezone: GMT+1
Joined: 2008-03-17
Posts: 33
Points: 7

I solved it by setting left

I solved it by setting left for each sub ul, not that elegant at all, but at least it works!