0

I'm currently using Dreamweaver to rework my site. This includes a mix of HTML for most of the content, and a JavaScript menu bar on every page. When I preview the page in my browser, the menu bar is aligned left. Below is the code for my entire page.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
	font: 100%/1.4 Verdana, Arial, Helvetica, sans-serif;
	background: #FFFFFF;
	margin: 0;
	padding: 0;
	color: #000;
}

/* ~~ Element/tag selectors ~~ */
ul, ol, dl { /* Due to variations between browsers, it's best practices to zero padding and margin on lists. For consistency, you can either specify the amounts you want here, or on the list items (LI, DT, DD) they contain. Remember that what you do here will cascade to the .nav list unless you write a more specific selector. */
	padding: 0;
	margin: 0;
}
h1, h2, h3, h4, h5, h6, p {
	margin-top: 0;	 /* removing the top margin gets around an issue where margins can escape from their containing div. The remaining bottom margin will hold it away from any elements that follow. */
	padding-right: 15px;
	padding-left: 15px; /* adding the padding to the sides of the elements within the divs, instead of the divs themselves, gets rid of any box model math. A nested div with side padding can also be used as an alternate method. */
}
a img { /* this selector removes the default blue border displayed in some browsers around an image when it is surrounded by a link */
	border: none;
}
/* ~~ Styling for your site's links must remain in this order - including the group of selectors that create the hover effect. ~~ */
a:link {
	color: #42413C;
	text-decoration: underline; /* unless you style your links to look extremely unique, it's best to provide underlines for quick visual identification */
}
a:visited {
	color: #6E6C64;
	text-decoration: underline;
}
a:hover, a:active, a:focus { /* this group of selectors will give a keyboard navigator the same hover experience as the person using a mouse. */
	text-decoration: none;
}

/* ~~ this fixed width container surrounds all other elements ~~ */
.container {
	width: 960px;
	background: #FFF;
	margin: 0 auto; /* the auto value on the sides, coupled with the width, centers the layout */
}

/* ~~ This is the layout information. ~~ 

1) Padding is only placed on the top and/or bottom of the div. The elements within this div have padding on their sides. This saves you from any "box model math". Keep in mind, if you add any side padding or border to the div itself, it will be added to the width you define to create the *total* width. You may also choose to remove the padding on the element in the div and place a second div within it with no width and the padding necessary for your design.

*/
.content {
	padding: 10px 0;
	font-family: "Helvetica Neue";
	font-size: 13px;
}

/* ~~ miscellaneous float/clear classes ~~ */
.fltrt {  /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
	float: right;
	margin-left: 8px;
}
.fltlft { /* this class can be used to float an element left in your page. The floated element must precede the element it should be next to on the page. */
	float: left;
	margin-right: 8px;
}
.clearfloat { /* this class can be placed on a <br /> or empty div as the final element following the last floated div (within the #container) if the overflow:hidden on the .container is removed */
	clear:both;
	height:0;
	font-size: 1px;
	line-height: 0px;
}
.container .content p {
	font-size: 13%;
}
.container .content p {
	font-size: 13pt;
}
.container .content p {
	font-size: 13px;
}
-->
</style></head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Spry Menu Bar - Basic : &lt;default&gt;</title>
<link type='text/css' href='Spry-UI-1.7/css/Menu/basic/SpryMenuBasic.css' rel='stylesheet'/>
<script type='text/javascript' src='Spry-UI-1.7/includes/SpryDOMUtils.js'></script>
<script type='text/javascript' src='Spry-UI-1.7/includes/SpryDOMEffects.js'></script>
<script type='text/javascript' src='Spry-UI-1.7/includes/SpryWidget.js'></script>
<script type='text/javascript' src='Spry-UI-1.7/includes/SpryMenu.js'></script>
<script type='text/javascript' src='Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarKeyNavigationPlugin.js'></script>
<script type='text/javascript' src='Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarIEWorkaroundsPlugin.js'></script>
<style type="text/css">
/* Settable values for skinning a Basic menu via presets. If presets are not sufficient, most skinning should be done in
	these rules, with the exception of the images used for down or right pointing arrows, which are in the file SpryMenuBasic.css
	
	 These assume the following widget classes for menu layout (set in a preset)
	.MenuBar - Applies to all menubars - default is horizontal bar, all submenus are vertical - 2nd level subs and beyond are pull-right.
	.MenuBarVertical - vertical main bar; all submenus are pull-right.
	
	You can also pass in extra classnames to set your desired top level menu bar layout. Normally, these are set by using a preset. 
	They only apply to horizontal menu bars:
		MenuBarLeftShrink - The menu bar will be horizontally 'shrinkwrapped' to be just large enough to hold its items, and left aligned
		MenuBarRightShrink - Just like MenuBarLeftShrink, but right aligned
		MenuBarFixedLeft - Fixed at a specified width set in the rule '.MenuBarFixedLeft', and left aligned.  
		MenuBarFixedCentered -  - Fixed at a specified width set in the rule '.MenuBarFixedCentered', 
						and centered in its parent container.
		MenuBarFullwidth - Grows to fill its parent container width.
 
	In general, all rules specified in this file are prefixed by #MenuBar so they only apply to instances of the widget inserted along
	with the rules. This permits use of multiple MenuBarBasic widgets on the same page with different layouts. Because of IE6 limitations,
	there are a few rules where this was not possible. Those rules are so noted in comments.
	
*/

#MenuBar  {
	background-color:#cccccc;	
	font-family: Arial, Helvetica, sans-serif; /* Specify fonts on on MenuBar and subMenu MenuItemContainer, so MenuItemContainer,
												MenuItem, and MenuItemLabel
												at a given level all use same definition for ems.
												Note that this means the size is also inherited to child submenus, 
												so use caution in using relative sizes other than
												100% on submenu fonts. */
	font-weight: normal;
	font-size: 16px;
	font-style: normal;
	padding:0;	
	border-color: #ffffff #ffffff #ffffff #ffffff; 
	border-width:0px;
	border-style: none none none none;
}
/* Caution: because ID+class selectors do not work properly in IE6, but we want to restrict these rules to just this
widget instance, we have used string-concatenated classnames for our selectors for the layout type of the menubar 
in this section. These have very low specificity, so be careful not to accidentally override them. */

.MenuBar br { /* using just a class so it has same specificity as the ".MenuBarFixedCentered br" rule bleow */
	display:none;
}
.MenuBarLeftShrink {
	float: left; /* shrink to content, as well as float the MenuBar */
	width: auto;
}
.MenuBarRightShrink {
	float: right; /* shrink to content, as well as float the MenuBar */
	width: auto;
}
.MenuBarFixedLeft {
	float: left;
	width: 80em;
}
.MenuBarFixedCentered {
	float: none;
	width: 80em;
	margin-left:auto;
	margin-right:auto;
}
.MenuBarFixedCentered br {
	clear:both;
	display:block;
}
.MenuBarFixedCentered .SubMenu br {
	display:none;
}
.MenuBarFullwidth {
	float: left;
	width: 100%;
}

/* Top level menubar items - these actually apply to all items, and get overridden for 1st or successive level submenus */
#MenuBar  .MenuItemContainer {
	padding: 0px 0px 0px 0px; 
	margin: 0; 	/* Zero out margin  on the item containers. The MenuItem is the active hover area.
				For most items, we have to do top or bottom padding or borders only on the MenuItem 
				or a child so we keep the entire submenu tiled with items.
				Setting this to 0 avoids "dead spots" for hovering. */
}
#MenuBar  .MenuItem {
	padding: 0px 24px 0px 0px; 
	background-color:#cccccc;	
	border-width:1px;
	border-color: #cccccc #ffffff #cccccc #ffffff; 
	border-style: none solid none solid;
}
#MenuBar  .MenuItemFirst {
	border-style: none none none none;
}
#MenuBar .MenuItemLast {
	border-style: none solid none none;
}

#MenuBar  .MenuItem  .MenuItemLabel{
	text-align:center;
	line-height:1.4em;
	color:#333333;
	background-color:#cccccc;
	padding: 6px 15px 6px 39px;
	width: 10em;
	width:auto; 
}
.SpryIsIE6 #MenuBar  .MenuItem  .MenuItemLabel{
	width:1em; /* Equivalent to min-width in modern browsers */
}

/* First level submenu items */
#MenuBar .SubMenu  .MenuItem {
	font-family: Arial, Helvetica, sans-serif;
	font-weight: normal;
	font-size: 14px;
	font-style: normal;
	background-color:#ffffff;
	padding:0px 2px 0px 0px;
	border-width:1px;
	border-color: #cccccc #cccccc #cccccc #cccccc; 
	/* Border styles are overriden by first and last items */
	border-style: solid solid none solid;
}
#MenuBar  .SubMenu .MenuItemFirst {
	border-style: solid solid none solid;
}
#MenuBar  .SubMenu .MenuItemFirst .MenuItemLabel{
	padding-top: 6px; 
}
#MenuBar .SubMenu .MenuItemLast {
	border-style: solid solid solid solid;
}
#MenuBar .SubMenu .MenuItemLast .MenuItemLabel{
	padding-bottom: 6px; 
}
#MenuBar .SubMenu .MenuItem .MenuItemLabel{
	text-align:left;
	line-height:1em;	
	background-color:#ffffff;
	color:#333333;
	padding: 6px 12px 6px 5px; 
	width: 7em;
	 
}

/* Hover states for containers, items and labels */
#MenuBar .MenuItemHover {
	background-color: #999999;
	border-color: #cccccc #cccccc #cccccc #cccccc; 
}

#MenuBar .MenuItemWithSubMenu.MenuItemHover .MenuItemLabel{
	background-color: #999999; /* consider exposing this prop separately*/
	color: #000000;
}
#MenuBar .MenuItemHover .MenuItemLabel{
	background-color: #999999;
	color: #000000;
}
#MenuBar .SubMenu .MenuItemHover {
	background-color: #cccccc; 
	border-color: #cccccc #cccccc #cccccc #cccccc; 
}

#MenuBar .SubMenu .MenuItemHover .MenuItemLabel{
	background-color: #cccccc; 
	color: #333333;
}
/* Submenu properties -- First level of submenus */
#MenuBar .SubMenuVisible {
	background-color: #ffffff;
	min-width:0%;  /* This keeps the menu from being skinnier than the parent MenuItemContainer - nice to have but not available on ie6 */
	border-color: #ffffff #ffffff #ffffff #ffffff; 
	border-width:0px;
	border-style: none none none none;
}
#MenuBar.MenuBar .SubMenuVisible {/* For Horizontal menubar only */
	top: 100%;	/* 100% is at the bottom of parent menuItemContainer */
	left:0px; /* 'left' may need tuning depending upon borders or padding applied to menubar MenuItemContainer or MenuItem, 
					and your personal taste.
					0px will left align the dropdown with the content area of the MenuItemContainer. Assuming you keep the margins 0 
					on MenuItemContainer and MenuItem on the parent
					menubar, making this equal the sum of the MenuItemContainer & MenuItem padding-left will align 
					the dropdown with the left of the menu item label.*/
	z-index:10;
}
#MenuBar.MenuBarVertical .SubMenuVisible {
	top: 0px;	
	left:100%;
	min-width:0px; /* Do not neeed to match width to parent MenuItemContainer - items will prevent total collapse */
}
/* Submenu properties -- Second level submenu and beyond - these are visible descendents of .MenuLevel1 */
#MenuBar .MenuLevel1 .SubMenuVisible {
	background-color: #ffffff;
	min-width:0px; /* Do not neeed to match width to parent MenuItemContainer - items will prevent total collapse*/
	top: 0px;	/* If desired, you can move this down a smidge to separate top item''s submenu from menubar - 
				that is really only needed for submenu on first item of MenuLevel1, or you can make it negative to make submenu more
				vertically 'centered' on its invoking item */
	left:100%; /* If you want to shift the submenu left to partially cover its invoking item, you can add a margin-left with a 
				negative value to this rule. Alternatively, if you use fixed-width items, you can change this left value
				to use px or ems to get the offset you want. */
}
/* IE6 rules - you can delete these if you do not want to support IE6 */

/* A note about multiple classes in IE6.
 * Some of the rules above use multiple class names on an element for selection, such as "hover" (MenuItemHover) and "has a subMenu" (MenuItemWithSubMenu),
 * giving the selector '.MenuItemWithSubMenu.MenuItemHover'.
 * Unfortunately IE6 does not support using mutiple classnames in a selector for an element. For a selector such as '.foo.bar.baz', IE6 ignores
 * all but the final classname (here, '.baz'), and sets the specificity accordingly, counting just one of those classs as significant. To get around this 
 * problem, we use the plugin in SpryMenuBarIEWorkaroundsPlugin.js to generate compound classnames for IE6, such as 'MenuItemWithSubMenuHover'. 
 * Since there are a lot of these needed, the plugin does not generate the extra classes for modern browsers, and we use the CSS2 style mutltiple class
 * syntax for that. Since IE6 both applies rules where 
 * it should not, and gets the specificity wrong too, we have to order rules carefully, so the rule misapplied in IE6 can be overridden. 
 * So, we put the multiple class rule first. IE6 will mistakenly apply this rule.  We follow this with the single-class rule that it would 
 * mistakenly override, making sure the  misinterpreted IE6 specificity is the same as the single-class selector, so the latter wins. 
 * We then create a copy of the multiple class rule, adding a '.SpryIsIE6' class as context, and making sure the specificity for
 * the selector is high enough to beat the single-class rule in the "both classes match" case. We place the IE6 rule at the end of the 
 * css style block to make it easy to delete if you want to drop IE6 support.
 * If you decide you do not need IE6 support, you can get rid of these, as well as the inclusion of the SpryMenuBarIEWorkaroundsPlugin.js script.
 * The 'SpryIsIE6' class is placed on the HTML element by  the script in SpryMenuBarIEWorkaroundsPlugin.js if the browser is Internet Explorer 6. This avoids the necessity of IE conditional comments for these rules.
 */
.SpryIsIE6 #MenuBar .MenuBarView .MenuItemWithSubMenuHover .MenuItemLabel /* IE6 selector  */{
	background-color: #999999; /* consider exposing this prop separately*/
	color: #000000;
}
.SpryIsIE6 #MenuBar .MenuBarView .SubMenu .MenuItemWithSubMenuHover .MenuItemLabel/* IE6 selector  */{
	background-color: #cccccc; /* consider exposing this prop separately*/
	color: #333333;
}
.SpryIsIE6 #MenuBar .SubMenu .SubMenu  /* IE6 selector  */{
	margin-left: -0px; /* Compensates for at least part of an IE6 "double padding" version of the "double margin" bug */
}
</style>
</head>

<body>
<ul id="MenuBar">
  <li> <a href="#">Home</a> </li>
  <li> <a href="#">Entertainment</a>
  <ul>
    <li> <a href="#">TV Listings</a> </li>
    <li> <a href="#">Music</a>
      <ul>
        <li> <a href="#">Hits</a> </li>
        <li> <a href="#">Ragga</a>
          <ul>
            <li> <a href="#">Roots</a> </li>
            <li> <a href="#">Reggaeton</a> </li>
            <li> <a href="#">Dancehall</a> </li>
          </ul>
        </li>
        <li> <a href="#">Country</a> </li>
      </ul>
    </li>
    <li> <a href="#">The Dirt</a>
      <ul>
        <li> <a href="#">Hollywood</a> </li>
        <li> <a href="#">NY Beat</a> </li>
        <li> <a href="#">London Scene</a> </li>
      </ul>
    </li>
    <li> <a href="#">The Web</a> </li>
  </ul>
  </li>
  <li> <a href="#">Politics</a> </li>
  <li> <a href="#">Sports</a>
    <ul>
      <li> <a href="#">Football</a> </li>
      <li> <a href="#">Baseball</a> </li>
      <li> <a href="#">Basketball</a> </li>
      <li> <a href="#">Racing</a>
        <ul>
          <li> <a href="#">F1</a> </li>
          <li> <a href="#">Indy Car</a> </li>
          <li> <a href="#">Stock Car</a> </li>
        </ul>
	  </li>
    </ul>
  </li>
  </ul>
<script type="text/javascript">
var MenuBar = new Spry.Widget.MenuBar2("#MenuBar", {
      widgetID: "MenuBar",
	  widgetClass: "MenuBar  MenuBarLeftShrink",
	  insertMenuBarBreak: true,
      mainMenuShowDelay: 100,
      mainMenuHideDelay: 200,
      subMenuShowDelay: 200,
      subMenuHideDelay: 200
      });
</script>
<div class="container">
  <div class="content">
    <h1>&nbsp;</h1>
    <h1>&nbsp;</h1>
    <h1><img src="../TAN redesign project/L_429imac27inch.jpg" width="967" height="690" /></h1>
    <p>The mid-2010 27&quot; iMac is the largest model of the latest incarnation in a long line of efficient, practical all-in-one desktop computers from Apple. For this review, but also as an upgrade from my old Hewlett-Packard PC, I purchased the low-end model from my local Apple Store. </p>
    <p><strong>Hardware</strong>:<br />
    It features an Intel Core i3 processor running at 3.2GHz, combined with 4GB of DDR3 memory at 1333MHz. The graphics are courtesy of an ATI Radeon HD 5670. The included hard drive has an enormous 1TB (1,000 GB) of storage space. </p>
    <p><strong>Software</strong>:<br />
      This particular iMac came with iLife '09, as it was purchased just under a month before the iLife '11 was introduced. I have ordered a copy of iLife '11 from Apple, and as soon as I get it in the mail and test it, I'll post a review in the Software and App Reviews section. Little needs to be said about iLife '09; it includes five applications (iPhoto, iMovie, iWeb, iDVD and GarageBand) that work seamlessly with Snow Leopard. </p>
    <p><strong>What's in the box:</strong><br />
      Included in the large white box are everything you'd expect: the minimalist aluminum Wireless Keyboard, the Magic Mouse, a power cord (which, by the way, is the only wire you'll need to power the computer), manual, troubleshooting guide, the iMac (of course), and even a soft, lint-free cleaning cloth, which you'll find yourself using quite often.</p>
    <p><strong>Testing</strong>:<br />
      <strong>First stage: AJA System Test</strong>.<br />
      Disk Read/Write: despite the fact that the iMac has a hard drive and not a solid state drive in the tested configuration, the disk read/write test (using a 1024mb file) scored extremely high: an average write speed comprised between 60.8MB/s and 255.4MB/s (during a spike at the very beginning of the test), with an average of 100.4MB/s. Read speeds varied between 35.0MB/s and 236.1MB/s with an average of 108.1. I would like to remind you that in this test, the maximum and minimum read/write speeds are during spikes, and that the average is what really counts. Nevertheless, a 102.25 average read/write speed is pretty amazing for a non-SSD. </p>
    <p><strong>Second stage: NovaBench </strong><br />
      According to NovaBench's tests, the 4GB of RAM have a data transfer rate of 5069MB/s. Just as a reference, RAM is technically a form of flash memory. SSDs are theoretically capable of data transfer rates of around 5GB/s, and higher quality SSDs, such as those available from storage solution giants SeaGate and Kingston may go much faster.<br />
      NovaBench's CPU tests revealed that the processor can handle 146,611,264 (one hundred an forty six million) gigaflops (flops stands for FLOating point OPerationS) per second. The world's fastest supercomputer, the Tianhe 1A in China does around 2.56 petaflops, or about one and a half billion (yes, the one with nine zeros) times faster. <br />
      The same test also showed 268,185,904 Integer operations per second, as well as 992,031 MD5 hashes calculated per second.<br />
      The GPU (graphics) tests performed by NovaBench included a very simple 3D graphics test comprising of what seemed to be polychromatic cubes rotating within eachother. The computer scored 453 frames per second, but the real graphics test is in the next section.<br />
      Overall, the 27&quot; iMac scored 819 on NovaBench's scale of 0-3000, with 3000 being the absolute maximum. Check out the scores at http://novabench.com/view/51486. Please note though, that the highest score recorded, which is around 2900, was by a high-end custom Mac Pro. </p>
    <p><strong>Third Stage: X-Plane 9</strong><br />
      Having set up the scenery, weather and time of day to put the most strain on the GPU, I took off in a Piaggio P.180 from Innsbruck airport in the Austrian Alps. I had X Plane display the frame rates, and the rates reached a minimum when I was flying just under the cloud cover and over Speicher Finestral (a lake not too far from the airport). The frame rates got to about 65 over the town of Innsbruck itself, before and after having left the airport. They averaged out at an impressive 38 fps (considering that the computer had to load the entire area, as well as clouds and dynamic lighting). </p>
    <p><strong>Fourth Stage: CineBench 11.5</strong><br />
      CineBench once again puts the computer's graphics and CPU to the test. In the graphics part of the test, which involves an intricately detailed car chase, the computer scored 26.82 frames per second average, while in the CPU test, which involved loading an extremely high resolution image of an abstract object, the iMac scored 2.50 points on a seemingly arbitrary scale that goes up to 12 points, with an Intel Xeon W5590 CPU @ 3.33GHz in the lead with 11.69.</p>
    <p><strong>The Verdict</strong><br />
      The mid-2010 iMac is a beautifully made computer, with enough hardware and software to satisfy the average user for a long time. Depending on a user's needs, the CPU can be upgraded to an i5, i5 quad, or i7, and the memory up to 16GB. I recommend this computer for anyone who really just needs a centralized workstation, that doubles as a place to edit photos and video, and surf the web, but doesn't have the budget for a Mac Pro, and won't compromise for a Mac Mini or MacBook. </p>
    <p><strong>What I liked</strong>: Big screen offering true-to-life colors, low-end model offers good hardware for the average user.<br />
      <strong>What I didn't like</strong>: The price, although reasonable for a computer this powerful, may be too much for the average user. </p>
    <p><strong>Gallery</strong></p>
    <p><!-- end .content --></p>
</div>
  <!-- end .container --></div>
</body>
</html>

And here's just the script:

</style></head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Spry Menu Bar - Basic : &lt;default&gt;</title>
<link type='text/css' href='Spry-UI-1.7/css/Menu/basic/SpryMenuBasic.css' rel='stylesheet'/>
<script type='text/javascript' src='Spry-UI-1.7/includes/SpryDOMUtils.js'></script>
<script type='text/javascript' src='Spry-UI-1.7/includes/SpryDOMEffects.js'></script>
<script type='text/javascript' src='Spry-UI-1.7/includes/SpryWidget.js'></script>
<script type='text/javascript' src='Spry-UI-1.7/includes/SpryMenu.js'></script>
<script type='text/javascript' src='Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarKeyNavigationPlugin.js'></script>
<script type='text/javascript' src='Spry-UI-1.7/includes/plugins/MenuBar2/SpryMenuBarIEWorkaroundsPlugin.js'></script>
<style type="text/css">
/* Settable values for skinning a Basic menu via presets. If presets are not sufficient, most skinning should be done in
	these rules, with the exception of the images used for down or right pointing arrows, which are in the file SpryMenuBasic.css
	
	 These assume the following widget classes for menu layout (set in a preset)
	.MenuBar - Applies to all menubars - default is horizontal bar, all submenus are vertical - 2nd level subs and beyond are pull-right.
	.MenuBarVertical - vertical main bar; all submenus are pull-right.
	
	You can also pass in extra classnames to set your desired top level menu bar layout. Normally, these are set by using a preset. 
	They only apply to horizontal menu bars:
		MenuBarLeftShrink - The menu bar will be horizontally 'shrinkwrapped' to be just large enough to hold its items, and left aligned
		MenuBarRightShrink - Just like MenuBarLeftShrink, but right aligned
		MenuBarFixedLeft - Fixed at a specified width set in the rule '.MenuBarFixedLeft', and left aligned.  
		MenuBarFixedCentered -  - Fixed at a specified width set in the rule '.MenuBarFixedCentered', 
						and centered in its parent container.
		MenuBarFullwidth - Grows to fill its parent container width.
 
	In general, all rules specified in this file are prefixed by #MenuBar so they only apply to instances of the widget inserted along
	with the rules. This permits use of multiple MenuBarBasic widgets on the same page with different layouts. Because of IE6 limitations,
	there are a few rules where this was not possible. Those rules are so noted in comments.
	
*/

#MenuBar  {
	background-color:#cccccc;	
	font-family: Arial, Helvetica, sans-serif; /* Specify fonts on on MenuBar and subMenu MenuItemContainer, so MenuItemContainer,
												MenuItem, and MenuItemLabel
												at a given level all use same definition for ems.
												Note that this means the size is also inherited to child submenus, 
												so use caution in using relative sizes other than
												100% on submenu fonts. */
	font-weight: normal;
	font-size: 16px;
	font-style: normal;
	padding:0;	
	border-color: #ffffff #ffffff #ffffff #ffffff; 
	border-width:0px;
	border-style: none none none none;
}
/* Caution: because ID+class selectors do not work properly in IE6, but we want to restrict these rules to just this
widget instance, we have used string-concatenated classnames for our selectors for the layout type of the menubar 
in this section. These have very low specificity, so be careful not to accidentally override them. */

.MenuBar br { /* using just a class so it has same specificity as the ".MenuBarFixedCentered br" rule bleow */
	display:none;
}
.MenuBarLeftShrink {
	float: left; /* shrink to content, as well as float the MenuBar */
	width: auto;
}
.MenuBarRightShrink {
	float: right; /* shrink to content, as well as float the MenuBar */
	width: auto;
}
.MenuBarFixedLeft {
	float: left;
	width: 80em;
}
.MenuBarFixedCentered {
	float: none;
	width: 80em;
	margin-left:auto;
	margin-right:auto;
}
.MenuBarFixedCentered br {
	clear:both;
	display:block;
}
.MenuBarFixedCentered .SubMenu br {
	display:none;
}
.MenuBarFullwidth {
	float: left;
	width: 100%;
}

/* Top level menubar items - these actually apply to all items, and get overridden for 1st or successive level submenus */
#MenuBar  .MenuItemContainer {
	padding: 0px 0px 0px 0px; 
	margin: 0; 	/* Zero out margin  on the item containers. The MenuItem is the active hover area.
				For most items, we have to do top or bottom padding or borders only on the MenuItem 
				or a child so we keep the entire submenu tiled with items.
				Setting this to 0 avoids "dead spots" for hovering. */
}
#MenuBar  .MenuItem {
	padding: 0px 24px 0px 0px; 
	background-color:#cccccc;	
	border-width:1px;
	border-color: #cccccc #ffffff #cccccc #ffffff; 
	border-style: none solid none solid;
}
#MenuBar  .MenuItemFirst {
	border-style: none none none none;
}
#MenuBar .MenuItemLast {
	border-style: none solid none none;
}

#MenuBar  .MenuItem  .MenuItemLabel{
	text-align:center;
	line-height:1.4em;
	color:#333333;
	background-color:#cccccc;
	padding: 6px 15px 6px 39px;
	width: 10em;
	width:auto; 
}
.SpryIsIE6 #MenuBar  .MenuItem  .MenuItemLabel{
	width:1em; /* Equivalent to min-width in modern browsers */
}

/* First level submenu items */
#MenuBar .SubMenu  .MenuItem {
	font-family: Arial, Helvetica, sans-serif;
	font-weight: normal;
	font-size: 14px;
	font-style: normal;
	background-color:#ffffff;
	padding:0px 2px 0px 0px;
	border-width:1px;
	border-color: #cccccc #cccccc #cccccc #cccccc; 
	/* Border styles are overriden by first and last items */
	border-style: solid solid none solid;
}
#MenuBar  .SubMenu .MenuItemFirst {
	border-style: solid solid none solid;
}
#MenuBar  .SubMenu .MenuItemFirst .MenuItemLabel{
	padding-top: 6px; 
}
#MenuBar .SubMenu .MenuItemLast {
	border-style: solid solid solid solid;
}
#MenuBar .SubMenu .MenuItemLast .MenuItemLabel{
	padding-bottom: 6px; 
}
#MenuBar .SubMenu .MenuItem .MenuItemLabel{
	text-align:left;
	line-height:1em;	
	background-color:#ffffff;
	color:#333333;
	padding: 6px 12px 6px 5px; 
	width: 7em;
	 
}

/* Hover states for containers, items and labels */
#MenuBar .MenuItemHover {
	background-color: #999999;
	border-color: #cccccc #cccccc #cccccc #cccccc; 
}

#MenuBar .MenuItemWithSubMenu.MenuItemHover .MenuItemLabel{
	background-color: #999999; /* consider exposing this prop separately*/
	color: #000000;
}
#MenuBar .MenuItemHover .MenuItemLabel{
	background-color: #999999;
	color: #000000;
}
#MenuBar .SubMenu .MenuItemHover {
	background-color: #cccccc; 
	border-color: #cccccc #cccccc #cccccc #cccccc; 
}

#MenuBar .SubMenu .MenuItemHover .MenuItemLabel{
	background-color: #cccccc; 
	color: #333333;
}
/* Submenu properties -- First level of submenus */
#MenuBar .SubMenuVisible {
	background-color: #ffffff;
	min-width:0%;  /* This keeps the menu from being skinnier than the parent MenuItemContainer - nice to have but not available on ie6 */
	border-color: #ffffff #ffffff #ffffff #ffffff; 
	border-width:0px;
	border-style: none none none none;
}
#MenuBar.MenuBar .SubMenuVisible {/* For Horizontal menubar only */
	top: 100%;	/* 100% is at the bottom of parent menuItemContainer */
	left:0px; /* 'left' may need tuning depending upon borders or padding applied to menubar MenuItemContainer or MenuItem, 
					and your personal taste.
					0px will left align the dropdown with the content area of the MenuItemContainer. Assuming you keep the margins 0 
					on MenuItemContainer and MenuItem on the parent
					menubar, making this equal the sum of the MenuItemContainer & MenuItem padding-left will align 
					the dropdown with the left of the menu item label.*/
	z-index:10;
}
#MenuBar.MenuBarVertical .SubMenuVisible {
	top: 0px;	
	left:100%;
	min-width:0px; /* Do not neeed to match width to parent MenuItemContainer - items will prevent total collapse */
}
/* Submenu properties -- Second level submenu and beyond - these are visible descendents of .MenuLevel1 */
#MenuBar .MenuLevel1 .SubMenuVisible {
	background-color: #ffffff;
	min-width:0px; /* Do not neeed to match width to parent MenuItemContainer - items will prevent total collapse*/
	top: 0px;	/* If desired, you can move this down a smidge to separate top item''s submenu from menubar - 
				that is really only needed for submenu on first item of MenuLevel1, or you can make it negative to make submenu more
				vertically 'centered' on its invoking item */
	left:100%; /* If you want to shift the submenu left to partially cover its invoking item, you can add a margin-left with a 
				negative value to this rule. Alternatively, if you use fixed-width items, you can change this left value
				to use px or ems to get the offset you want. */
}
/* IE6 rules - you can delete these if you do not want to support IE6 */

/* A note about multiple classes in IE6.
 * Some of the rules above use multiple class names on an element for selection, such as "hover" (MenuItemHover) and "has a subMenu" (MenuItemWithSubMenu),
 * giving the selector '.MenuItemWithSubMenu.MenuItemHover'.
 * Unfortunately IE6 does not support using mutiple classnames in a selector for an element. For a selector such as '.foo.bar.baz', IE6 ignores
 * all but the final classname (here, '.baz'), and sets the specificity accordingly, counting just one of those classs as significant. To get around this 
 * problem, we use the plugin in SpryMenuBarIEWorkaroundsPlugin.js to generate compound classnames for IE6, such as 'MenuItemWithSubMenuHover'. 
 * Since there are a lot of these needed, the plugin does not generate the extra classes for modern browsers, and we use the CSS2 style mutltiple class
 * syntax for that. Since IE6 both applies rules where 
 * it should not, and gets the specificity wrong too, we have to order rules carefully, so the rule misapplied in IE6 can be overridden. 
 * So, we put the multiple class rule first. IE6 will mistakenly apply this rule.  We follow this with the single-class rule that it would 
 * mistakenly override, making sure the  misinterpreted IE6 specificity is the same as the single-class selector, so the latter wins. 
 * We then create a copy of the multiple class rule, adding a '.SpryIsIE6' class as context, and making sure the specificity for
 * the selector is high enough to beat the single-class rule in the "both classes match" case. We place the IE6 rule at the end of the 
 * css style block to make it easy to delete if you want to drop IE6 support.
 * If you decide you do not need IE6 support, you can get rid of these, as well as the inclusion of the SpryMenuBarIEWorkaroundsPlugin.js script.
 * The 'SpryIsIE6' class is placed on the HTML element by  the script in SpryMenuBarIEWorkaroundsPlugin.js if the browser is Internet Explorer 6. This avoids the necessity of IE conditional comments for these rules.
 */
.SpryIsIE6 #MenuBar .MenuBarView .MenuItemWithSubMenuHover .MenuItemLabel /* IE6 selector  */{
	background-color: #999999; /* consider exposing this prop separately*/
	color: #000000;
}
.SpryIsIE6 #MenuBar .MenuBarView .SubMenu .MenuItemWithSubMenuHover .MenuItemLabel/* IE6 selector  */{
	background-color: #cccccc; /* consider exposing this prop separately*/
	color: #333333;
}
.SpryIsIE6 #MenuBar .SubMenu .SubMenu  /* IE6 selector  */{
	margin-left: -0px; /* Compensates for at least part of an IE6 "double padding" version of the "double margin" bug */
}
</style>
</head>

<body>
<ul id="MenuBar">
  <li> <a href="#">Home</a> </li>
  <li> <a href="#">Entertainment</a>
  <ul>
    <li> <a href="#">TV Listings</a> </li>
    <li> <a href="#">Music</a>
      <ul>
        <li> <a href="#">Hits</a> </li>
        <li> <a href="#">Ragga</a>
          <ul>
            <li> <a href="#">Roots</a> </li>
            <li> <a href="#">Reggaeton</a> </li>
            <li> <a href="#">Dancehall</a> </li>
          </ul>
        </li>
        <li> <a href="#">Country</a> </li>
      </ul>
    </li>
    <li> <a href="#">The Dirt</a>
      <ul>
        <li> <a href="#">Hollywood</a> </li>
        <li> <a href="#">NY Beat</a> </li>
        <li> <a href="#">London Scene</a> </li>
      </ul>
    </li>
    <li> <a href="#">The Web</a> </li>
  </ul>
  </li>
  <li> <a href="#">Politics</a> </li>
  <li> <a href="#">Sports</a>
    <ul>
      <li> <a href="#">Football</a> </li>
      <li> <a href="#">Baseball</a> </li>
      <li> <a href="#">Basketball</a> </li>
      <li> <a href="#">Racing</a>
        <ul>
          <li> <a href="#">F1</a> </li>
          <li> <a href="#">Indy Car</a> </li>
          <li> <a href="#">Stock Car</a> </li>
        </ul>
	  </li>
    </ul>
  </li>
  </ul>
<script type="text/javascript">
var MenuBar = new Spry.Widget.MenuBar2("#MenuBar", {
      widgetID: "MenuBar",
	  widgetClass: "MenuBar  MenuBarLeftShrink",
	  insertMenuBarBreak: true,
      mainMenuShowDelay: 100,
      mainMenuHideDelay: 200,
      subMenuShowDelay: 200,
      subMenuHideDelay: 200
      });
</script>

Is there any way to align this script center?

2
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by Verandaguy
0

Align what script??? I am not sure what you mean by 'aligning' the script? You mean the display HTML part? By the way, this is not going to work... Your code is too much and it would not help at all even in code tag. You may need to look at it and think which part of your code actually needs to do the 'center'. :(

0

I'm new to Java and HTML, but the object I'm trying to center on the page contains the words

java

and

javascript

, so I thought it was in JavaScript (in fact, I'm still pretty sure). Try opening the code in Dreamweaver and previewing it in a browser, or saving is as a .html using TextEdit or NotePad, and you'll see what I mean. The grey menu bar at the top of the screen is quite visibly off center. I wanted to align it with the center of the browser window, like i.e. the menu bar on top of every DaniWeb page.

0

In this case, it is JavaScript. Still, you have not answered me what part of the content you posted to be center? Do you mean by display or on your page? How would you use your HTML display? The content of the script should not be displayed on the HTML page. Also, centering it on your display won't help you or other to read your code either. So... I am not sure you really want???

0

So you want your table to be centered on your page? In your CSS class 'content', add margin-left: auto; to it.

.content {
  padding: 10px 0;
  font-family: "Helvetica Neue";
  font-size: 13px;
  margin-left: auto;
}
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.