• Resolved snowcrab302

    (@snowcrab302)


    I’m trying to have the images in my posts have a margin depending on how the image is aligned. For example, if the image is set to align left (from the drop-down menu on the write/edit post on the admin side of WordPress), I need WordPress to automatically add a margin to the right.

    Which is why Im looking for the file where WordPress generates the html. I would have the php write out an inline CSS to add the margin depending on the alignent, but I can’t seem to find it.

    Any help would be greatly appreaciated. Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Why not simply define it in your stylesheet?
    Example only:
    .primary img {
    margin-left: -5px;
    padding: 4px;
    border: 1px solid #ccc;
    max-width: 100%;
    }

    .center {
    text-align: center;
    }

    .alignright {
    float: right;
    }

    .alignleft {
    float: left
    }

    img.center, img[align="right"] {
    display: block;
    margin-left: auto;
    margin-right: auto;
    }

    img.alignright, img[align="right"] {
    padding: 4px;
    margin: 0 0 2px 7px;
    display: inline;
    }

    img.alignleft, img[align="left"] {
    padding: 4px;
    margin: 0 7px 2px 0;
    display: inline;
    }

    img.noborder {
    border: none !important;
    }

    .favorite img {
    padding: 0;
    border: none;
    }

    Or am I misunderstanding?

    Thread Starter snowcrab302

    (@snowcrab302)

    Thanks so much! That solved the problem perfectly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘where is the code generated for images in posts?’ is closed to new replies.