• Resolved glenncvance

    (@glenncvance)


    The problem I’m having is that even though I have image padding built into my CSS, I can’t get the images to actually show that padding on the left or right side of an image. Here’s the CSS code –

    p img {
    max-width: 100%;
    display: block;
    margin: 6px 0;
    color: #900;
    line-height: 1.6em;
    border: 5px dotted #ffffff;
    overflow: auto;

    }

    img.centered {
    padding: 15px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    }

    img.alignright {
    padding: 10px;
    margin: 0 0 2px 7px;
    display: inline;
    }

    img.alignleft {
    padding: 10px;
    margin: 0 15px 2px 0;
    display: inline;
    }

    And here’s a page I set up to show my problem.
    http://www.tellyouwhatithink.com/test-page/

    Any help would be appreciated. Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • As far as I know the padding should work only if there is a “container” element around the image – like a border. To get a distance between the text and image… use the margin.

    Yes, what moshu said. “Padding” is meant for *inside* the borders of an element, margins are for the outside.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Image Padding Not Working’ is closed to new replies.