WordPress.org

Ready to get started?Download WordPress

Forums

Centering Navigation (8 posts)

  1. kingsmithstudio
    Member
    Posted 1 year ago #

    I am having all sorts of trouble centering my links in the navigation bar (under the header). I've tried the text:align (center), but am still having no luck. I'm working on a local machine so the site's not live. Any thoughts on how to do this, and also on the child navigational links that are on the second tier (horizontal), would be deeply appreciated.

    Here's the code (hope it's not too long for this):

    #nav {
    	display: block;
    	float: right;
    	width: 924px;
    	background-color: #410013;
    	height: 40px;
    	margin-right: 0px;
    	margin-bottom: 0px;
    	border-right-width: 8px;
    	border-left-width: 8px;
    	border-right-style: solid;
    	border-left-style: solid;
    	border-right-color: #FFF;
    	border-left-color: #FFF;
    	margin-left: 0px;
    	}
    
    #nav li {
    	margin-right:25px;
    	padding-top: 10px;
    	padding-right: 10px;
    	padding-bottom: 10px;
    	padding-left: 10px;
    	font-size: 19px;
    	color: #FFF;
    	}
    
    #nav li, #subnav li {
    	float:left;
    	list-style:none
    	}
    
    #nav a, #nav a:visited {
    	color:#FFF;
    	text-decoration:none;
    	}
    
    #nav a:hover, #nav a:active,
    li.current_page_parent a,
    li.current_page_parent a:visited,
    #nav li.current_page_item a,
    #nav li.current_page_item a:visited
            {
    	color: #608b82;
    	font-weight: bold;
    	text-transform: uppercase;
    	}
    #subnav {
    	display: block;
    	float: right;
    	width: 926px;
    	background-color: #BEBCAD;
    	height: auto;
    	margin-right: -5px;
    	margin-bottom: 0px;
    	border-right-width: 10px;
    	border-left-width: 10px;
    	border-right-style: solid;
    	border-left-style: solid;
    	border-right-color: #FFF;
    	border-left-color: #FFF;
    	margin-left: 10px;
    	padding-top: 8px;
    	padding-bottom: 8px;
    	}
    
    #subnav li {
    	color: #2b443f;
    	line-height: 1px;
    	margin-top: 8px;
    	margin-right: 10px;
    	margin-bottom: 10px;
    	margin-left: 10px;
    	padding-top: 0px;
    	padding-right: 0px;
    	padding-left: 0px;
    	}
    
    #subnav a, #subnav a:visited {
    	color:#2b443f;
    	text-decoration:none;
    	}
    
    #subnav a:hover, #subnav a:active,
    #subnav li.current_page_item a,
    #subnav li.current_page_item a:visited {
    	text-transform: uppercase;
    	font-weight: bold;
    	}
  2. esmi
    Forum Moderator
    Posted 1 year ago #

    I'm sorry but it is beyond the scope of these forums to deal with general CSS issues. Try a dedicated CSS resource such as http://www.css-discuss.org/ instead. In the meantime, using Firefox with the Firebug add-on for this kind of CSS work.
    http://getfirebug.com/

  3. kingsmithstudio
    Member
    Posted 1 year ago #

    Had no luck with firebug ... and saw some css issues here.

    Alas, I shall try the link you sent. Thanks for that.

  4. Andrew
    Forum Moderator
    Posted 1 year ago #

  5. kingsmithstudio
    Member
    Posted 1 year ago #

    Would it have been better if I had put in the php code that I need to style in wordpress? Perhaps I need to put in code there to make the centering happen? I tried one of the other forums...but they are suggesting php changes (and are vague enough to really cause me more confusion).

    <ul id="nav">
    <?php wp_nav_menu('title_li=&depth=1'); ?>
    </ul>
    <?php if($post->post_parent)
    $children = wp_nav_menu("title_li=&child_of=".$post->post_parent."&echo=0"); else
    $children = wp_nav_menu("title_li=&child_of=".$post->ID."&echo=0");
    if ($children && is_page()) { ?>
    <ul id="subnav">
    <?php echo $children; ?>
    </ul></p>
    <?php } else { ?>
    <?php } ?>
  6. Andrew
    Forum Moderator
    Posted 1 year ago #

    Try searching for similar threads http://wordpress.org/search/

  7. kingsmithstudio
    Member
    Posted 1 year ago #

    Thanks, Andrew. Have spent more hours on this than you would know searching for a workable solution.

  8. Andrew
    Forum Moderator
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic