how do i fix this and center justify it?
here is the code for the single page php file:
<?php /** * The Template for displaying all single posts. * * @package WordPress * @subpackage Twenty_Eleven * @since Twenty Eleven 1.0 */ get_header(); ?> <div id="primary"> <div id="content" role="main"> <?php while ( have_posts() ) : the_post(); ?> <nav id="nav-single"> <h3 class="assistive-text"><?php _e( 'Post navigation', 'twentyeleven' ); ?></h3> <span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">←</span> Previous', 'twentyeleven' ) ); ?></span> <span class="nav-next"><?php next_post_link( '%link', __( 'Next <span class="meta-nav">→</span>', 'twentyeleven' ) ); ?></span> </nav><!-- #nav-single --> <?php get_template_part( 'content', 'single' ); ?> <?php if (get_option( 'nomnom_display_related' )): ?><!-- Recent Related posts switch --> <?php get_template_part('related'); ?> <?php endif; ?> <br clear="all"> <?php comments_template( '', true ); ?> <?php endwhile; // end of the loop. ?> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar(); ?><!-- This is the sidebar call for single post pages--> <?php get_footer(); ?>
i see the lines in the middle that correspond to the previous and next buttons, but i dont know how to edit the code to fix the buttons and center justify it. im hoping someone else can do that
someone suggested this:
#nav-single { float: center; }
is that what i want?
someone suggested this:
#nav-single { float: center; } is that what i want? |
Are you kidding me? There’s no "center" property for float. This also has little to do with PHP. It’s purely a CSS issue.
I’d text-align the parent element to center and display those elements inline.
Be getto
<div align="center"> PUT CODE YOU WANT CENTERED HERE</div>
It works a lot of times, and while its not proper it will not cause your site to lose rankings or anything. It will just not be clean code , cause you know everyone views websites in source only. lol
Are you kidding me? There’s no "center" property for float. This also has little to do with PHP. It’s purely a CSS issue.
I’d text-align the parent element to center and display those elements inline. |
You still on GChat?
You still on GChat? |
pharamoken ae?
ionno if this applies to what you want, but you can do this to get stuff centered.
position:relative; margin-left:auto; margin-right:auto;
You don’t need position: relative. And that only applies to block elements with a specified width
Do you have this page hosted online somewhere? A link would be great. Either way, this is actually quite simple.
#nav-single {
width:___px; // make this the width of the content area
}
.nav-previous {
float:left;
}
.nav-next {
float:right;
}
Setting a fixed width on the nav container will ensure that the prev/next buttons are flushed (justified as you called it) when you set the floats.
Problem solved. Don’t forget to clear the floats via clearfix.
a browser extension like firebug makes fixing shit like this really easy. Lets you make live css changes on the page so you can see what works or not. Once you get it figured out, just transfer the changes to the actual css file(s).
Another handy tool is recss, a bookmarklet to reload your css without reloading the whole page.