WordPress.org

Support

Support » Themes and Templates » Align Center Class Won't Work

Align Center Class Won't Work

  • I have this class in my .css file:

    .aligncenter,
    div.aligncenter {
       display: block;
       margin-left: auto;
       margin-right: auto;
    	}

    I apply it as follows:

    <div class="aligncenter">
    		  <?php echo do_shortcode('[mapsmarker layer="1"]'); ?>
    	  </div>

    If I manually set the align property of the div tag, the content is centered. If I use that class, it is not. Any idea why this is?

Viewing 13 replies - 1 through 13 (of 13 total)
  • WPyogi

    @wpyogi

    Forum Moderator

    Pretty hard to debug CSS without seeing the live page… There might be other CSS or HTML structure reasons it’s not working. Try using Firebug on the rendered page to see what’s going on.

    WPyogi

    @wpyogi

    Forum Moderator

    Which element is it? I don’t see any class=”aligncenter” on that page (try search on the rendered page).

    I was live editing just now, I just put the page back to how it was before. I was trying a class called “test-align”, with ridiculous properties, to ensure that the class was even having effect. I’m not sure it is actually, as nothing changed, with some crazy high values.

    WPyogi

    @wpyogi

    Forum Moderator

    Try this instead:

    .aligncenter, div.aligncenter {
        display: table;
        margin-left: auto;
        margin-right: auto;
    }

    No change with that.

    WPyogi

    @wpyogi

    Forum Moderator

    Now I don’t see that element at all. Are you clearing your browser cache?

    I’m going incognito, and clearing when / if needed. I’ve been live editing to attempt to fix this myself, with no luck. Seeing as you’re responding very quickly, I’ll stop editing and set it as stated above so we can work on it together.

    WPyogi

    @wpyogi

    Forum Moderator

    Now that CSS seems to be gone…

    The current page displays the map, aligned left, despite it using the aligncenter class. I changed block to table, as you suggested, which is in the current build.

    EDIT – there was an unwanted -, I had align-center on accident, updated.

    WPyogi

    @wpyogi

    Forum Moderator

    That CSS is not visible. I also just noticed that that theme is not released under GPL licensing – so it’s really not a good theme to be using at all. And we really cannot help with those themes here, sorry, I should have checked on that earlier.

    I’d really suggest you find a theme that’s consistent with the values and requirements of WP.

    This maybe useful as well:

    http://www.chipbennett.net/2010/12/10/only-download-wordpress-themes-from-trusted-sources/

    What about this theme is against the GPL Licensing? Someone mentioned this to me once before, but gave me no information on why that was.

    I have no idea what is required for the theme to be accepted, but I’ll gladly alter it to do so, if someone tells me what’s wrong with the current setup >.<

    Moderator Andrew Nevins

    @anevins

    Forum moderator

    We don’t know why your theme is not released under GPL.
    If you would kindly follow the link by clicking on the text, “GPL licensing” in WPyogi’s last post, that should explain what license is acceptable by WordPress.org.

    In forum posts on WordPress.org people often convey links through text, so when you see blue and underlined text that means there is a link attached to it. This is what WPyogi posted when she last talked to you about your non-GPL theme.

    It is worth reading on that Chip Bennett resource too that WPyogi posted.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Align Center Class Won't Work’ is closed to new replies.