css menu question - Post ID 163191

User 271657 Photo


Ambassador
3,816 posts

First - this hasn't been published yet. I'll include a pic and the code. I'm trying to get this horizontal menu sized to the page width (960 px). I've messed with all the margins, padding, borders... but I can't find where the extra space at each end is coming from. In the top example, the menu 'space' is 960 px, but I can't figure out how to get the buttons to fill this (and I don't want big gaps between them).
The bottom picture is how I would like to have this. I'm adding this to a VSD site with the HTML tool if that helps explain anything :lol:

http://i48.servimg.com/u/f48/14/58/51/55/menu-p11.jpg

<style>

#rollover ul{
margin:0;
padding:0;
border:0;
list-style-image:none;}

#rollover li {
list-style-image:none;
font-size: 14px;
font-family: "arial" "helvetica" "sans-serif";
font-weight: bold;
letter-spacing: 0.1em;
/**Makes horizontal menus. Remove the next rule for vertical menus**/
display:inline;
/**adjust space between items**/
padding: 0;
margin-left:0;
margin-right:0;
border: 0;
}

/**LINK STYLE**/

#rollover li a {
/**space around link**/
padding-top: 12px;
padding-right: 20px;
padding-bottom: 12px;
padding-left: 20px;
border: 0;
height: 0.75em;
/**for IE**/
line-height:1.0em;}

/**TEXT LINK STATES**/

#rollover li a {text-decoration:none;}
#rollover li a:link {color:white}
#rollover li a:visited {color:#f7f8af}
/**on mouseover**/
#rollover li a:hover,
#rollover li a:active,
#rollover li a:focus {color: white; text-decoration:underline;}

/**LINK CLASSES & BACKGROUNDS**/

#rollover a.item1 {
background: #05376f;}

#rollover li a.item1:hover,
#rollover li a.item1:active,
#rollover li a.item1:focus {
background: #05376f; }

#rollover a.item2 {
background: #6eb82a;}

#rollover a.item2:hover,
#rollover a.item2:active,
#rollover a.item2:focus {
background: #6eb82a}

#rollover a.item3 {
background: #b90072;}

#rollover a.item3:hover,
#rollover a.item3:active,
#rollover a.item3:focus {
background: #b90072;}

#rollover a.item4 {
background: #048cf5;}

#rollover a.item4:hover,
#rollover a.item4:active,
#rollover a.item4:focus {
background: #048cf5;}

#rollover a.item5 {
background: #20c38d;}

#rollover a.item5:hover,
#rollover a.item5:active,
#rollover a.item5:focus {
background: #20c38d;}

#rollover a.item6 {
background: #e74124;}

#rollover a.item6:hover,
#rollover a.item6:active,
#rollover a.item6:focus {
background: #e74124;}
/**END ROLLOVER**/

</style>



<ul id="rollover">
<li><a href="#" class="item1">flipple home</a></li>
<li><a href="#" class="item2">the flipple story</a></li>
<li><a href="#" class="item3">more flipple uses</a></li>
<li><a href="#" class="item4">about us</a></li>
<li><a href="#" class="item5">contact us</a></li>
<li><a href="#" class="item6">shop now</a></li>


</ul>


Any advice?
I love deadlines. I like the whooshing sound they make as they fly by. (Douglas Adams)
https://www.callendales.com
User 364143 Photo


Guest
5,410 posts

All I did was paste your code into an html file and change the body background to black and there was no space on either side of the menu as you indicated. So, additional code is required.
CoffeeCup... Yeah, they are the best!
User 187934 Photo


Senior Advisor
20,271 posts

I was able to get you menu to appear correct if I made the HTML box 1000 and set the link style padding to 33.5. I placed the html box flush to the right hand side of the page.

Tomalicious knows enough not to need VSD but not enough to use it.;):lol:
Attachments:
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 271657 Photo


Ambassador
3,816 posts

Thanks for doing that Eric. So the page could be 960 px - and it would be OK for the HTML box to 'hang' off the page?
I love deadlines. I like the whooshing sound they make as they fly by. (Douglas Adams)
https://www.callendales.com
User 187934 Photo


Senior Advisor
20,271 posts

I minimized and maximized the browser window back and forth and it held its position.:) I have a menu that I have hanging off to display correct. It's not hanging as much as yours needs to be but it always seems to display correctly.:)
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 271657 Photo


Ambassador
3,816 posts

OK, good to know. ;) I about made myself nuts trying to figure out what's causing that space. It looks like the whole menu is inside of a DIV, but I can't find out where that would have come from :P
I love deadlines. I like the whooshing sound they make as they fly by. (Douglas Adams)
https://www.callendales.com
User 117361 Photo


Ambassador
6,076 posts

Thanks for doing that Eric. So the page could be 960 px - and it would be OK for the HTML box to 'hang' off the page?


Bit worried about the sound of this :(
Have a check in several browsers before you decide that the hanging is ok :rolleyes:
User 364143 Photo


Guest
5,410 posts

Eric Rohloff wrote:
Tomalicious knows enough not to need VSD but not enough to use it.;):lol:
I know enough to know that it wasn't that code causing the issue.
CoffeeCup... Yeah, they are the best!

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.