Results 1 to 7 of 7

Thread: Can this be aligned to center?

  1. #1
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Red face Can this be aligned to center?

    hi just been playing around with the Glossy Horizontal Menu that is avalible on the CSS section on the site but cant seem to center this menu with out it messing up when you put it in a differnt windowsize/screen rez?

    is there some way you can set it so that its always centered?

    please help!

    Code:
    <style type="text/css">
      
    /*Credits: By Santosh Setty (http://webdesigninfo.wordpress.com) */
    /*Posted to: Dynamic Drive CSS Library (http://www.dynamicdrive.com/style/) */
    
    .glossymenu{
    	position: fixed;
    	padding: 0 0 0 0s;
    	margin: 0 -10 0 -10;
    	background: url(images/menub_bg.gif) repeat-x; /*tab background image path*/
    	height: 46px;
    
    }
    
    .glossymenu li{
    	float:left;
    }
    
    .glossymenu li a{
    	float: left;
    	display: block;
    	color:#000;
    	text-decoration: none;
    	font-family: sans-serif;
    	font-size: 13px;
    	font-weight: bold;
    	padding:0 0 0 16px; /*Padding to accomodate left tab image. Do not change*/
    	height: 46px;
    	line-height: 46px;
    	text-align: center;
    	cursor: pointer;	
    }
    
    .glossymenu li a b{
    	float: left;
    	display: block;
    	padding: 0 24px 0 8px; /*Padding of menu items*/
    }
    
    .glossymenu li.current a, .glossymenu li a:hover{
    	color: #fff;
    	background: url(images/menub_hover_left.gif) no-repeat; /*left tab image path*/
    	background-position: left;
    }
    
    .glossymenu li.current a b, .glossymenu li a:hover b{
    	color: #fff;
    	background: url(images/menub_hover_right.gif) no-repeat right top; /*right tab image path*/
    }
    
    </style>
    
    <ul class="glossymenu">
    	<li class="current"><a href="http://www.dynamicdrive.com/"><b>Home</b></a></li>
    	<li><a href="http://www.dynamicdrive.com/style/"><b>CSS</b></a></li>
    	<li><a href="http://www.dynamicdrive.com/forums/"><b>Forums</b></a></li>	
    	<li><a href="http://tools.dynamicdrive.com"><b>Webmaster Tools</b></a></li>	
    	<li><a href="http://www.javascriptkit.com/"><b>JavaScript</b></a></li>	
    	<li><a href="http://www.cssdrive.com"><b>Gallery</b></a></li>	
    </ul>

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    You will need a relative positioned container div with a defined width to place it in.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    um ok how do i do that!?

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    by viewing this thread
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Still not working

    ok i have placed it within a div and set to div to center but it still on the left and still have the problem of wanting it to be centered and relitive when viewed with differnt screen sizes???

    heres what i got:

    HTML Code:
    <style type="text/css">
      
    /*Credits: By Santosh Setty (http://webdesigninfo.wordpress.com) */
    /*Posted to: Dynamic Drive CSS Library (http://www.dynamicdrive.com/style/) */
    
    #wrapper {
        position: relative;
        text-align: Center;
    }
    
    .glossymenu{
    	position:relative;
    	padding: 0 0 0 0;
    	margin: 0 -10 0 -10;
    	background: url(images/menub_bg.gif) repeat-x; /*tab background image path*/
    	height: 46px;
    
    }
    
    .glossymenu li{
    
    	float:left;
    }
    
    .glossymenu li a{
    	float: left;
    	display: block;
    	color:#000;
    	text-decoration: none;
    	font-family: sans-serif;
    	font-size: 13px;
    	font-weight: bold;
    	padding:0 0 0 16px; /*Padding to accomodate left tab image. Do not change*/
    	height: 46px;
    	line-height: 46px;
    	text-align: center;
    	cursor: pointer;	
    }
    
    .glossymenu li a b{
    	float: left;
    	display: block;
    	padding: 0 24px 0 8px; /*Padding of menu items*/
    }
    
    .glossymenu li.current a, .glossymenu li a:hover{
    	color: #fff;
    	background: url(images/menub_hover_left.gif) no-repeat; /*left tab image path*/
    	background-position: left;
    }
    
    .glossymenu li.current a b, .glossymenu li a:hover b{
    	color: #fff;
    	background: url(images/menub_hover_right.gif) no-repeat right top; /*right tab image path*/
    }
    
    </style>
    
    <div id="wrapper">
    <ul class="glossymenu">
    	<li class="current"><a href="http://www.dynamicdrive.com/"><b>Home</b></a></li>
    	<li><a href="http://www.dynamicdrive.com/style/"><b>CSS</b></a></li>
    	<li><a href="http://www.dynamicdrive.com/forums/"><b>Forums</b></a></li>	
    	<li><a href="http://tools.dynamicdrive.com"><b>Webmaster Tools</b></a></li>	
    	<li><a href="http://www.javascriptkit.com/"><b>JavaScript</b></a></li>	
    	<li><a href="http://www.cssdrive.com"><b>Gallery</b></a></li>	
    </ul>
    </div>

  6. #6
    Join Date
    Feb 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default still need help

    can anyone assist me any further as im still stuck with this cheers.

  7. #7
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    You have to define a width size to the wrapper, even if it is 100% or 900px or 50em... something.

    Also, the elements inside wrapper will need to be positioned absolute, not relative, as wrapper is relative.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •