I have a problem with some basic css stuff I was browseing the net for this but found examples but none of that explained my problem:
Page template [HTML]:
<div id="container" class="gallery-list"> <!-----gallery-list---->
<div id="content" role="main">
<h1 class="page-title"><?php the_title(); ?></h1>
<div id="gallery-list-container" class="list-container">
<?php wp_reset_query(); ?>
<?php
// Set up the arguments for retrieving the pages
$args = array(
'post_type' => 'page',
'numberposts' => -1,
'post_status' => null,
// $post->ID gets the ID of the current page
'post_parent' => $post->ID,
'order' => ASC,
'orderby' => title
);
$subpages = get_posts($args);
if ($subpages[0]) :?>
<div class="gallery-list-wrap">
<?php
// Just another WordPress Loop
foreach($subpages as $post) :
setup_postdata($post);
?>
<div id="post-<?php the_ID(); ?>" class="list-entry-container">
<?php
$count++;
// Show the Post thumbnail
if ( has_post_thumbnail() ) : ?>
<div class="list-entry">
<a class="size-small" href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a>
<h2 class="list-entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'highart' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
</div><!-- .entry-content -->
<?php
// Show the High Art image
else : ?>
<div class="entry-content">
<?php highart_entry_image_attachment('thumbnail') ?>
</div><!-- .entry-content -->
<?php endif; ?>
<div class="entry-utility">
<?php edit_post_link( __( 'Edit', 'highart' ), '<span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-utility -->
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</div><!-- #content -->
</div><!-- #container -->
[CSS]
#main .gallery-list{margin:0;width:925px;overflow:hidden; display:block;}
#main .gallery-list #content{width:925px;}
.list-container{margin:0 auto; display:block; padding:11px 0 0; list-style:none; border-bottom: 1px solid lightgray;}
.gallery-list #gallery-list-container {margin-top:-22px;float:none; width:925px;}
.gallery-list li {display:inline;width:185px;height:241px;margin-right:25px;padding:22px 0 44px;border:1px solid lightgray;border-width:0 0 0; position:relative; overflow:hidden;}
.gallery-list #gallery-list-container li {min-height:252px; display:inline;clear:none;padding-bottom:25px;}
.gallery-list-wrap{display:inline; float:left; margin:0 auto;}
.list-entry-container {display:inline; float:left;}
.gallery-list .list-entry{display:inline;width:165px;font-size: 9px; font-weight:400; line-height:11px; text-transform:uppercase; padding:5px 0 6px;}
.gallery-list-line-wrap{margin: 0 auto; display:block;}
why the div: gallery-list-wrap is not centering on the container?
It just stay’s aligned to the left of the container.
In this case I don’t really understand how the browser processes this.
Probably a newbie question but I just can’t seem to figure it out
EDIT1:
According to the answers below this could be a problematic approach on this so some backstory:
I have a div that is containing div’s of subpages with thumbnails and titles of a page. so far so good the problem is I don’t know how manny there are so I don’t know if I have 1,2,3 or 4 per line I would like to have maximum 4 per line and each line centered to the container
is this eaven doable?
Thanks for help.
You need to remove
and add a width to the gallery-list-wrap.
At the moment you have margin-left and margin-right set to auto which is the correct thing to do, however for it to work properly you need to define a width as well.
So if you are having two div’s in there, work out their combined width and apply that to the gallery-list-wrap.
I hope this helps.