CSS Menu assistance needed - Page 1

User 38401 Photo


Senior Advisor
10,951 posts

Hiya all,

Before I pull out the few hairs I have left on my head, I'd surely appreciate any help you can give me to figure out how to correct the drop down spacing of this menu. I'm trying to recreate my menu on my website to a CSS menu rather than using the java menu program that I've used forever and I just can't seem to find this spacing problem. I most likely have some things not setup correctly and probably causing the problem myself lol. I've adapted this from a menu I found on the cssplay site if that helps any. Here's a link to the menu and hopefully someone has some idea what I can do to get this finished so I can actually give it a try.

http:// sitesandbox.info/cssblankmenupage.html

(I am learning not to leave perma links here if not needed in case I don't need them later lol, so I have a space in there after the // to keep it from being a direct link, please copy and paste it to your browser and remove that space to view it)

P.S. there are no links on it, it's just text menu at the moment so I am aware that the menu doesn't actually work to link to anything. I'll get that all added in and the actual structure setup correctly once I get the thing working right lol.

Thanks for any help you can give :)
User 133269 Photo


Registered User
2,900 posts

i guess this line could be your problem
padding-top: 15px; /* moves text up/down by moving that whole area down, seems to affect dropdown line spacing too, needs to be fixed */


is that your comment or theirs?

looks like it uses the same height/padding/lineheight settings for both the top buttons and the dropdowns...?

i quite like this one for a menu....
http://www.dynamicdrive.com/dynamicinde … /index.htm

Have fun
~ Fe Pixie ~
User 38401 Photo


Senior Advisor
10,951 posts

Yeah I love that chrome one too, but just trying to get this one to match the shop menu for now. At some point I'm sure I'll be redoing a new theme, but not when I can't even figure this out lol.

Is there any way to separate those 2 settings, so that there are a separate padding for the main menu and 1 for the dropdown so I can change that number? That's my comment btw, when I'm trying to figure things out I try to comment what I find as I go lol.
User 117361 Photo


Ambassador
6,076 posts

Jo Ann

Then the code for the horizontal menu in this site is below. If it helps, take what you need from it. All in css (with images incorporated)
vallejoviolinlessons.com
/* begin Menu */
/* menu structure */

.pierotti-menu a, .pierotti-menu a:link, .pierotti-menu a:visited, .pierotti-menu a:hover
{
text-align:left;
text-decoration:none;
outline:none;
letter-spacing:normal;
word-spacing:normal;
}

.pierotti-menu, .pierotti-menu ul
{
margin: 0;
padding: 0;
border: 0;
list-style-type: none;
display: block;
}

.pierotti-menu li
{
margin: 0;
padding: 0;
border: 0;
display: block;
float: left;
position: relative;
z-index: 5;
background:none;
}

.pierotti-menu li:hover
{
z-index: 10000;
white-space: normal;
}

.pierotti-menu li li
{
float: none;
}

.pierotti-menu ul
{
visibility: hidden;
position: absolute;
z-index: 10;
left: 0;
top: 0;
background:none;
}

.pierotti-menu li:hover>ul
{
visibility: visible;
top: 100%;
}

.pierotti-menu li li:hover>ul
{
top: 0;
left: 100%;
}

.pierotti-menu:after, .pierotti-menu ul:after
{
content: ".";
height: 0;
display: block;
visibility: hidden;
overflow: hidden;
clear: both;
}
.pierotti-menu, .pierotti-menu ul
{
min-height: 0;
}

.pierotti-menu ul
{
background-image: url(images/spacer.gif);
padding: 10px 30px 30px 30px;
margin: -10px 0 0 -30px;
}

.pierotti-menu ul ul
{
padding: 30px 30px 30px 10px;
margin: -30px 0 0 -10px;
}





/* menu structure */

.pierotti-menu
{
padding: 0px 0px 0px 0px;
}

.pierotti-nav
{
position: relative;
height: 38px;
z-index: 100;
}

.pierotti-nav .l, .pierotti-nav .r
{
position: absolute;
z-index: -1;
top: 0;
height: 38px;
background-image: url('images/nav.png');
}

.pierotti-nav .l
{
left: 0;
right:0px;
}

.pierotti-nav .r
{
right: 0;
width: 924px;
clip: rect(auto, auto, auto, 924px);
}


/* end Menu */

/* begin MenuItem */
.pierotti-menu ul li
{
clear: both;
}

.pierotti-menu a
{
position:relative;
display: block;
overflow:hidden;
height: 38px;
cursor: pointer;
text-decoration: none;
margin-right: 0px;
margin-left: 0px;
}


.pierotti-menu a .r, .pierotti-menu a .l
{
position:absolute;
display: block;
top:0;
z-index:-1;
height: 114px;
background-image: url('images/MenuItem.png');
}

.pierotti-menu a .l
{
left:0;
right:0px;
}

.pierotti-menu a .r
{
width:400px;
right:0;
clip: rect(auto, auto, auto, 400px);
}

.pierotti-menu a .t
{
font-family: "Comic Sans MS", Tahoma, Arial, Sans-Serif;
font-size: 14px;
font-style: normal;
font-weight: normal;
color: #2E363E;
padding: 0 10px;
margin: 0 0px;
line-height: 38px;
text-align: center;
}

.pierotti-menu a:hover .l, .pierotti-menu a:hover .r
{
top:-38px;
}

.pierotti-menu li:hover>a .l, .pierotti-menu li:hover>a .r
{
top:-38px;
}

.pierotti-menu li:hover a .l, .pierotti-menu li:hover a .r
{
top:-38px;
}
.pierotti-menu a:hover .t
{
color: #E8EEF3;
}

.pierotti-menu li:hover a .t
{
color: #E8EEF3;
}

.pierotti-menu li:hover>a .t
{
color: #E8EEF3;
}



/* end MenuItem */

/* begin MenuSeparator */
.pierotti-nav .pierotti-menu-separator
{
display: block;
width: 8px;
height: 38px;
background-image: url('images/MenuSeparator.png');
}

/* end MenuSeparator */

/* begin MenuSubItem */
.pierotti-menu ul a
{
display:block;
text-align: center;
white-space: nowrap;
height: 26px;
width: 180px;
overflow:hidden;
line-height: 26px;
margin-right: auto;


background-image: url('images/subitem-bg.png');
background-position: left top;
background-repeat: repeat-x;
border-width: 1px;
border-style: solid;
border-color: #5F071A;
}

.pierotti-nav ul.pierotti-menu ul span, .pierotti-nav ul.pierotti-menu ul span span
{
display: inline;
float: none;
margin: inherit;
padding: inherit;
background-image: none;
text-align: inherit;
text-decoration: inherit;
}

.pierotti-menu ul a, .pierotti-menu ul a:link, .pierotti-menu ul a:visited, .pierotti-menu ul a:hover, .pierotti-menu ul a:active, .pierotti-nav ul.pierotti-menu ul span, .pierotti-nav ul.pierotti-menu ul span span
{
text-align: left;
text-indent: 12px;
text-decoration: none;
line-height: 26px;
color: #4C5A67;
font-family: "Comic Sans MS", Tahoma, Arial, Sans-Serif;
font-size: 12px;
font-style: normal;
font-weight: normal;
}

.pierotti-menu ul ul a
{
margin-left: auto;
}

.pierotti-menu ul li a:hover
{
color: #EBF0F4;
border-color: #023616;
background-position: 0 -26px;
}

.pierotti-menu ul li:hover>a
{
color: #EBF0F4;
border-color: #023616;
background-position: 0 -26px;
}

.pierotti-nav .pierotti-menu ul li a:hover span, .pierotti-nav .pierotti-menu ul li a:hover span span
{
color: #EBF0F4;
}

.pierotti-nav .pierotti-menu ul li:hover>a span, .pierotti-nav .pierotti-menu ul li:hover>a span span
{
color: #EBF0F4;
}


/* end MenuSubItem */


I think you should be able to resolve these no break spaces with some padding somewhere
<li><a class="hide">&nbsp;&nbsp;&nbsp;Home</a>

What do these 50px height refer to?
.menu ul li a, .menu ul li a:visited {
display:block;
text-decoration:none;
font-weight: bold;
padding-top: 15px; /* moves text up/down by moving that whole area down, seems to affect dropdown line spacing too, needs to be fixed */
width:124px; /* main button graphic width */
height:50px;
text-align:left;
color:#4F2054;
border:0px;
background: url(../images/button.png) no-repeat; /* main button graphic */
line-height:20px;
font-size:12px;
overflow:hidden;
User 117361 Photo


Ambassador
6,076 posts

Jo Ann
I have been through all your menu, and it looks very much as if the sub-menu is using more or less the same parameters as the image section of your menu. Whereas it works ok for the images, it looks to me as if you should try and separate the areas with two sets of code so that the sub-items are not so widely spaced etc.
User 38401 Photo


Senior Advisor
10,951 posts

Hiya Janys,

I'll try to take a look at your setup there and see what's different. Man something I thought was gonna be so simple kicks me in the butt again LOL.

I tried messing around with the padding thing on the no break spaces, but finally gave up and just added them lol. I'm sure you're right though and I just need to find the right place for it.

The height:50px is the button image height and doesn't seem to affect the spacing between the drop down items at all.
User 117361 Photo


Ambassador
6,076 posts

Right now I am trying to ditch some of the stuff in that menu which will not be of any use to you and see if I can get down to the bare essentials to make your sub menu behave better. Maybe post something a bit later when I have managed to get my head around this. Which menu did you pick from Stu Nicholls site for this... can you give me a link?

Ok... I think I found it so I will take a look.
User 38401 Photo


Senior Advisor
10,951 posts

hiya Janys,

Thanks so very much for taking a look at this, CSS is definitely not a strong point for me yet. Just in case you still need the link this is the one I altered (I am sure I could have probably found an easier one to alter I supposed? lol):
http://www.cssplay.co.uk/menus/dd_valid.html
User 117361 Photo


Ambassador
6,076 posts

So if I have picked the correct menu, it started out without images, correct? The blue and purple dropdown css menu? That will definitely be where the problem lies seeing as the images need much more space for display than the skinny sub-items. We'll work it out...just go take a coffee for a bit.
User 38401 Photo


Senior Advisor
10,951 posts

Hehe yeah that sounds like the right one. Thought I was doing sooo good just to be able to get the main menu to look right, all the while thinking the drop down part was going to be the easy part because I didn't have to mess with any images.... just goes to show ya I guess lol.

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.