Why does all my pictures stay to the left?

  • Author
    Posts
  • #503246

    mirajakobsen
    Member

    After I put in this code in the CSS sheet:

    p {
    margin:10px;
    }

    p img.aligncenter {
    margin-left:-10px;
    }

    to make sure the text was a bit narrower than the pictures, I can’t seem to get the pictures centered anymore. Any help?

    Blog: http://miira.wordpress.com

    The blog I need help with is mirajakobsen.wordpress.com.

    #503414

    hallluke
    Member

    That breaks when the images are smaller than the width of the blog. Here’s another attempt which should work whatever size the images are. Delete the code you posted above and replace it with:

    #content p {position:relative; left:10px; width:680px;}
    #content p img {position:relative; left:-10px;}
    #503444

    mirajakobsen
    Member

    That helped me a lot! I changed it to your new code and the width to 660px from 680px to make the text the same on both left and right side, is that the right way to do it?

    #503449

    hallluke
    Member

    In my broswer that makes the sides uneven, the gap on the right side is greater. You have a few odd margin and padding settings throughout the blog but I can’t tell if that is part of the original theme or from modifications that you’ve made. Try replacing everything above with the code below, if that doesn’t make everything work then stick with what you have if it looks good to you.

    div#content {padding:0; margin:0; width:730px;}
    div#content .post {width:700px; padding:5px 15px;}
    div#content p {position:relative; left:10px; width:680px;}
    div#content p img {position:relative; left:-10px;}
    #503457

    mirajakobsen
    Member

    Thanks, I replaced it now and it seemed to make the space to the left greater, I would want the same difference between picture and text to be on the left side too. I’ve also gone through all the modifications I’ve done to clean up a bit with the paddings and margins, but don’t know if there’s anything else to do about it as I don’t know too much about this.

    #503463

    hallluke
    Member

    It looks fine to me right now, well done!

    On an unrelated note: you might want to try reducing the number of posts that get displayed on each page. There are up to 50 fairly large images loading each time I view a page and that slows the load time down considerably. You could consider either reducing the number of posts, or use something like the more tag to show less of the photos on the main page.

    #503472

    mirajakobsen
    Member

    I have now reduced the number of posts shown on each page to 7, it was 10 before. It should help a bit hopefully..
    Thanks for all the help, I wish I knew how to fix all the small annoying things myself :)

    #503493

    shimworld
    Member

    Don’t why it’s so easy keep two side by side images to the left of page but impossible to centre them together.

The topic ‘Why does all my pictures stay to the left?’ is closed to new replies.