Creative COW SIGN IN :: SPONSORS :: ABOUT US :: CONTACT US
ADOBE DREAMWEAVER: HomeDreamweaver ForumDreamweaver TutorialsFAQAdobe FlashWeb Design

Centering a horizontal spy menu bar

Cow Forums : Adobe Dreamweaver

<< PREVIOUS THREAD   •   VIEW ALL THREADS   •   PRINT   •   NEXT THREAD >>
Centering a horizontal spy menu bar
by Lee Margolies on Nov 5, 2009 at 9:34:32 pm

I'm trying to center a horizontal spy menu bar on a page. For some reason IE, FF and Safari are all left justifying the menu and if I don't have a padding property (see below) in the ul.MenuBarHorizontal it shifts the entire bar about 20 pixels to the right.

Any help you can offer is appreciated...
Thanx,
lm

Site Address: http://www.capitologic.com/TEST/index.html

SpryMenuBarHorizontal.css:

@charset "UTF-8";

/* SpryMenuBarHorizontal.css - version 0.6 - Spry Pre-Release 1.6.1 */

/* Copyright (c) 2006. Adobe Systems Incorporated. All rights reserved. */

/*******************************************************************************

LAYOUT INFORMATION: describes box model, positioning, z-order

*******************************************************************************/

/* The outermost container of the Menu Bar, an auto width box with no margin or padding */
ul.MenuBarHorizontal
{
margin: 0;
padding: 0;
width: 666px;
}
/* Set the active Menu Bar with this class, currently setting z-index to accomodate IE rendering bug: http://therealcrisp.xs4all.nl/meuk/IE-zindexbug.html */
ul.MenuBarActive
{
z-index: 1000;
}
/* Menu item containers, position children relative to this container and are a fixed width */
ul.MenuBarHorizontal li
{
list-style-type: none;
font-size: 100%;
position: relative;
line-height: -15;
cursor: pointer;
width: 133.2px;
float: left;
}
/* Submenus should appear below their parent (top: 0) with a higher z-index, but they are initially off the left side of the screen (-1000em) */
ul.MenuBarHorizontal ul
{
margin: 0;
padding: 0;
list-style-type: none;
font-size: 100%;
z-index: 1020;
cursor: default;
left: -1000em;
width: 160px;
position: absolute;
background-color: #005dab;
color: #fff;
}
/* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to auto so it comes onto the screen below its parent menu item */
ul.MenuBarHorizontal ul.MenuBarSubmenuVisible
{
left: auto;

}
/* Menu item containers are same fixed width as parent */
ul.MenuBarHorizontal ul li
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: normal;
width: 160px;
border-width: 1px 2px 1px 2px;
border-style: solid;
border-color: #005dab;
background-color: transparent;
float: none;
margin: 0 0 0 -1.5%;

}

/* Submenu that is showing with class designation MenuBarSubmenuVisible, we set left to 0 so it comes onto the screen */
ul.MenuBarHorizontal ul.MenuBarSubmenuVisible ul.MenuBarSubmenuVisible
{
left: auto;
top: 0;
}

/*******************************************************************************

DESIGN INFORMATION: describes color scheme, borders, fonts

*******************************************************************************/


/* Menu items are a light gray block with padding and no text decoration */
ul.MenuBarHorizontal a
{
display: block;
cursor: pointer;
background-color: #FFF;
padding: 0.5em 0.75em;
color: #005dab;
text-decoration: none;
text-align: center;
}
/* Menu items that have mouse over or focus have a blue background and white text */
ul.MenuBarHorizontal a:hover, ul.MenuBarHorizontal a:focus
{
background-color: #005dab;
color: #FFF;
}
ul.MenuBarHorizontal ul a {
text-align: left;
}
/* Menu items that are open with submenus are set to MenuBarItemHover with a blue background and white text */
ul.MenuBarHorizontal a.MenuBarItemHover, ul.MenuBarHorizontal a.MenuBarItemSubmenuHover, ul.MenuBarHorizontal a.MenuBarSubmenuVisible
{

text-decoration: none
}
/* HACK FOR IE: to stabilize appearance of menu items; the slash in float is to keep IE 5.0 from parsing */
@media screen, projection
{
ul.MenuBarHorizontal li.MenuBarItemIE
{
display: inline;
f\loat: left;
}
}

************************************************************************************

main.css:

@charset "UTF-8";

/*Top, Right, Bottom, Left*/

h1 {
font-size: 14px;
color: #000;
}
h2 {
font-size: 13px;
color: #000;
}
body {
font-family: Arial, Helvetica, sans-serif;
background-repeat: repeat;
background-image: url(../images/bkgdIMAGE.png);
margin: 0;
padding: 0;
position: relative;
text-align: center;
}
#wrapper {
background-color: #FFF;
width: 1004px;
font-family: Arial, Helvetica, sans-serif;
text-align: left;
color: #FFF;
margin-left: auto;
margin-right: auto;
}

#sidebarLeft {
font-family: Arial, Helvetica, sans-serif;
margin: 0px;
float: left;
padding: 0px;
height: 608px;
width: 160px;
border: 3px solid #038;
}

#sidebarRight {
background-color: #FFF;
margin: 0px;
padding: 0px;
height: 608px;
width: 160px;
float: left;
font-family: Arial, Helvetica, sans-serif;
color: #FFF;
border: 3px solid #038;
}

#mainBody {
font-family: Arial, Helvetica, sans-serif;
color: #FFF;
background-color: #FFF;
padding: 0px;
height: 608px;
width: 672px;
float: left;
margin-right: auto;
margin-left: auto;
border-top-width: 3px;
border-bottom-width: 3px;
border-top-style: solid;
border-bottom-style: solid;
border-top-color: #038;
border-bottom-color: #038;
position: relative;
}
#header {
font-family: Arial, Helvetica, sans-serif;
color: #FFF;
margin-right: auto;
margin-left: auto;
height: 99px;
width: 666px;
border-top-width: 3px;
border-right-width: 2px;
border-bottom-width: 2px;
border-left-width: 2px;
border-top-style: solid;
border-right-style: solid;
border-bottom-style: none;
border-left-style: solid;
border-top-color: #EEE;
border-right-color: #EEE;
border-bottom-color: #EEE;
border-left-color: #EEE;
}
#navbar {
background-color: #005dab;
width: 662px;
margin-right: auto;
margin-left: auto;
margin-bottom: 0px;
border-right-width: 2px;
border-left-width: 2px;
border-bottom-width: 2px;
border-right-style: solid;
border-bottom-style: solid;
border-left-style: solid;
border-right-color: #005dab;
border-bottom-color: #005dab;
border-left-color: #005dab;
height: 30px;
position: relative;


}
/* ---------------- header specific styles ----------------*/

#navbar li a:link, #navbar li a:visited {
display: block;
font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
font-weight: bold;
color: #005dab;
text-decoration: none;
line-height: 24px;
margin-right: 2px;
margin-left: 0%;
padding: .2em .5em;
}
#navbar li a.current, #navbar li a.current:hover, #navbar li a.current:active {
color: #FFF;
cursor: default;
background-color: #005dab;
}
#navbar li a:hover, #navbar li a:active {
color: #FFF;
background: #005dab;
}
#navbar li ul a:link, #navbar li ul a:visited {
font-size: 13px;
font-weight: normal;
margin-left: auto;
margin-right: auto;
padding: .2em .5em;
}

#navbar li ul a:hover, #navbar li ul a:actve{
color: #FFF;
background: #005dab;
}

#bodyText {
padding: 5px;
height: 225px;
margin-top: 5px;
margin-right: 5px;
margin-bottom: 5px;
margin-left: 5px;
}
#imagesBoxes {
background-color: #FFF;
height: 175px;
margin: 0px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;

width: inherit;
}
#sidebarRight #HeadlinesBox #TextBox {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
text-align: left;
width: 157px;
padding: 0px;
margin: 0px;
}
#imagesboxesTitle {
background-color: #FFF;
margin: 0px;
padding: 0px;
height: 20px;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #000;
text-align: center;
vertical-align: middle;
font-weight: bold;
}
#imagebox1 {
background-color: #FFF;
margin: 0px;
padding: 0px;
width: 168px;
height: 127px;
float: left;
}
#imagebox2 {
background-color: #FFF;
margin: 0px;
padding: 0px;
width: 168px;
height: 127px;
float: left;
}
#imagebox3 {
background-color: #FFF;
margin: 0px;
padding: 0px;
width: 168px;
height: 127px;
float: left;
}
#imagebox4 {
background-color: #FFF;
margin: 0px;
padding: 0px;
width: 168px;
height: 127px;
float: left;
}
#missionStatement {
background-color: #FFF;
width: 161px;
height: 74px;
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #000;
text-align: center;
font-weight: bold;
display: table-cell;
line-height: 14px;
}
#headlinesBNR {
height: 28px;
width: 161px;
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
font-weight: bold;
color: #FFF;
background-image: url(../images/HeadlinesBNR.jpg);
line-height: 28px;
text-align: center;
}
#HeadlinesBox {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #000;
background-color: #FFF;
text-align: center;
margin: 0px;
height: 305px;
padding: 0px;
font-weight: bold;
}
#HeadlinesFeed {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000;
text-align: left;
display: block;
width: 155px;
margin-right: auto;
margin-left: auto;
font-weight: bold;
height: 287px;
}
#RSSBNR {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
color: #FFF;
background-image: url(../images/HeadlinesBNR.jpg);
margin: 0px;
padding: 0px;
height: 28px;
width: 161px;
text-align: center;
line-height: 28px;
}
#RSSBox {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
color: #000;
background-color: #FFF;
text-align: center;
margin: 0px;
padding: 0px;
font-weight: bold;
line-height: 97%;
}
#RSSFeed {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000;
text-align: left;
display: block
width: 155px;
margin-left: auto;
margin-right: auto;

}






Respond to this post   •   Return to posts index

Re: Centering a horizontal spy menu bar
by Fernando Mol on Nov 6, 2009 at 3:39:14 pm

You need to play with your widths.

Now, the whole width of your menu doesn't divide itself in the number of menu elements you have. Remember, screens measures in pixels.

Change the width of your center column (where you have your menu fitted) and make it a width that can be divided into 5, the number of menu items you have. Then, play with the width of your list items and borders to fit it.

I hope this helps

*Remember to share a link to your site and to rate the posts. This is a free service for you and for us.

Respond to this post   •   Return to posts index

Re: Centering a horizontal spy menu bar
by Lee Margolies on Nov 6, 2009 at 10:45:55 pm

Thanks for the help...

I tried adjusting the width and it still comes up either too small or too long. Since the spry is nested in a div tag (navbar), do I need to only adjust that div's width to a multiple of 5 or do I need to go further up the chain?

thanks again!
lm

Lee Margolies
http://www.lmcreativemotion.com
Twitter: @LMCreativeMotio

Respond to this post   •   Return to posts index


Re: Centering a horizontal spy menu bar
by Fernando Mol on Nov 7, 2009 at 12:49:12 am

Your menu is inside a container. That container must be divided by 5 to a square number.

That is the number you must give to the width of each menu element. Considering boders.

I'm not telling you exactly where to put the numbers, but it's a trial and error process, but I hope you get the idea.

Follow this rule too: the divisible number must be a pair.

*Remember to share a link to your site and to rate the posts. This is a free service for you and for us.

Respond to this post   •   Return to posts index

<< PREVIOUS THREAD   •   VIEW ALL THREADS   •   PRINT   •   NEXT THREAD >>


FORUMSTUTORIALSMAGAZINETRAININGVIDEOS - REELSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

© CreativeCOW.net All rights are reserved.

[Top]