• can someone give me some hints on how to add a border and padding to a posted image in my style sheet?

    i have looked through it, but i am not sure which part i need to modify.

    here’s my css

    body {
    padding: 0px;
    margin: 0px auto;
    text-align: center;
    background: #4D5562/*url(images/bg-main.gif) repeat-x*/;
    font: 12px/20px Verdana, Arial, Tahoma, sans-serif;
    }

    a:link {
    color: #666;
    text-decoration: none;
    }

    a:visited {
    color: #696969;
    text-decoration: none;
    }
    a:hover {
    color: #95322C;
    text-decoration: underline;
    }

    #heading {
    background: #4D5562 url/*(images/bg-header.gif) no-repeat*/;
    width: 750px;
    height: 0px;
    margin: 0px auto 0px;
    color: #000;
    text-align: left;
    }

    #header {
    padding-top: 0px;
    padding-left: 10px;
    }

    h1 {
    font: 24px “Trebuchet MS”, Georgia, serif;
    margin: 0;
    }

    h1 a:link, h1 a:visited {
    text-decoration: none;
    color: #6D6D74;
    }

    h2 {
    font: italic normal 14px “Trebuchet MS”, Georgia, serif;
    margin: 0;
    }

    h3 {
    margin: 1em 0 .2em;
    font: 18px “Trebuchet MS”, Georgia,Serif;
    color: #000;
    padding-left: 0px;
    }

    h4 {
    font: 14px Georgia, serif;
    margin: 2px;
    font-weight: bold;
    color: #6D6D74;
    }

    h3 a:link, h3 a:visited {
    text-decoration: none;
    color: #4D5562;
    }

    h3 a:hover {
    text-decoration: underline;
    color: #4D5562;
    }

    #content {
    background: #FFFFFF;
    margin: 0 auto;
    padding: 0px 0px 0px 0px;
    width: 750px;
    text-align: left;
    }

    #navigation {
    margin: 0 0px 0px 0px;
    }

    #minitabs {
    margin: 0;
    padding: 7px 0 20px 5px;
    background: #000000;
    text-transform: uppercase;
    }

    #minitabs li {
    margin: 0;
    padding: 0;
    display: inline;
    list-style-type: none;
    }

    #minitabs a:link, #minitabs a:visited {
    float: left;
    font-size: 11px;
    line-height: 12px;
    font-weight: bold;
    margin: 0 10px 4px 10px;
    text-decoration: none;
    color: #FFFFFF;
    }

    li.current_page_item a, #minitabs a:hover {
    background: #000000;
    text-decoration: underline;
    color: #FFFFFF;
    }

    #main {
    float: left;
    margin: 0 10px 0px 0px;
    background: #FFFFFF;
    padding: 5px 15px;
    width: 515px;
    }

    #sidebar {
    background: #FFFFFF;
    width: 165px;
    length: 700px;
    margin: 0px 10px 5px 565px;
    }

    #sidebar ul {

    margin-top: 1px;
    padding-left: 6px;
    margin: 0;
    list-style-type: none;
    }

    #sidebar li {
    padding-left: 6px;
    }

    #footer {
    clear: both;
    horizontal-align: middle;
    width: 750 px;
    background: #000000;
    text-align: center;
    color: #FFFFFF;
    padding: 5px;
    }

    #footer p {
    margin: 0;
    font-size: 12px;
    }

    #footer a:link, #footer a:visited {
    color: #FFFFFF;
    font-weight: bold;
    font-size: 12px;
    }

    .meta {
    color: #6D6D74;
    font-size: 11px;
    margin: 0;
    }

    .entry {
    padding-bottom: 25px;
    background: url(images/entry-separate.gif) no-repeat center bottom;
    }

    blockquote {
    border-left: 2px solid #6D6D74;
    padding-left: 5px;
    }

    .commentbox {
    border: 1px solid #6D6D74;
    margin: 5px 2px;
    padding: 5px;
    }

    .alignleft {
    float: left;
    }

    .alignright {
    float: right;
    }

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’m not going to go through your whole list, but to add border and padding to images:

    img {border:solid 1px black; padding: 5px; margin: 5px}

    Will put a thin black border around EVERY image on your site with a white space (so to speak) between the border and the image, and then space between the border and the surrounding text/content.

    If you would like to only style the image in, say, your sidebar, and your sidebar is called menu, then it would look like this:

    #menu img {border:solid 1px black; padding: 5px;.....}

    If you want to put space around a specific image, you can create an inline style like this:

    <img src="ball.gif" alt="picture of a red ball" style="border:solid 1px black; padding: 5px; margin:5px" />

    Does that help?

    Well is the image is in the navigation div:

    #main img {
    border: 1px black solid; /* change to desired color and width */
    margin: 5px;
    padding: 5px;
    }
    or

    #side bar img {
    border: 1px black solid; /* change to desired color and width */
    margin: 5px;
    padding: 5px;
    }

    This will do it too all the images in those div’s.

    For a single or once in a while use:

    img.bordered {
    border: 1px black solid; /* change to desired color and width */
    margin: 5px;
    padding: 5px;
    }

    <img src=”img.gif” width=”10″ height=”10″ alt=”alt name” class=”bordered” />

    Thread Starter rob2003

    (@rob2003)

    Lorelle – Thanks, you’re awesome. That is what I needed. I don’t mind coding it like that at all.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Image border and padding’ is closed to new replies.