Literary Spring Designs
Skip to content
  • About LS Designs
  • Contact LS Designs
  • WordPress Resources
« Using Stock Photography Without Losing Your Mind
Comic Style Tutorial »

CSS Borders

By Rebecca | Published: February 10, 2010

CSS borders are a nice way to add a little something extra to a picture. The trick is to set the image apart from the rest of the article or post without the border overwhelming the image.

Border Properties

  • border-width: This is the width of your border (ie 5px)
  • border-style: none (no border), solid, dotted, dashed, double, groove, ridge, inset, outset
  • border-color: You can use a color name, hex value (ie #369), or RGB value (ie rgb(0,0,255))
  • To make a border with different styles on each side use: border-top-style, border-right-style, border-bottom-style, border-left-style

Thick Brown Border

nameofimage

The CSS

img.nameofclass {
border: 3px solid #300;
padding: 5px;
background: #630;
}

The xhtml:

nameofimage

Blue Double Border

nameofimage

The css:

img.nameofclass {
border: 5px double #399;
padding: 3px;
background: #9cc;
}

The xhtml:

nameofimage

Orange Inset Border

nameofimage

The css:

 img.nameofclass {
border: 5px inset #fc6;
padding: 3px;
background: #c30;
}

The xhtml:

nameofimage

Green Ridge Border

nameofimage

The css:

img.nameofclass {
border: 8px ridge #cf9;
padding: 2px 2px;
background: #063;
}

The xhtml:

nameofimage

Blue Variable Border

nameofimage

The css:

img.nameofclass {
border-top: 8px groove #399;
border-right: 5px solid #063;
border-bottom: 8px groove #399;
border-left: 5px solid #063;
padding: 2px;
background: #fff;
}

The xhtml:

nameofimage

How to use the code listed above

  • Replace “nameofclass” with whatever name you want to use for the type of images you want to have a particular border. If you wanted a certain border for all pictures of buildings you might use img.buildingpics. It is best not to use the name of the picture (ie TowerofLondon.jpg) unless you will only be using a specific border for one picture.
  • “Name of Image” is usually the name of the file or a very brief description of it (ie TowerofLondon)
  • The xhtml will be used in the part of your document where you want the image with the border. On this page I used the xhtml in the body of the document in div with the main content just below the h2 heading.
  • The CSS portion will go in your stylesheet.
  • Share/Bookmark
This entry was posted in tutorial and tagged css, tutorial. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.
« Using Stock Photography Without Losing Your Mind
Comic Style Tutorial »

Post a Comment

Click here to cancel reply.

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • rss twitter tumblr"

  • Categories

    • designing a website
    • fonts
    • fractals
    • freebies
    • inspiration
    • mobile
    • other
    • photography
    • photoshop resources
    • resources
    • tutorial
    • wallpapers
  • Tags

    3d css fonts fractal freebies incendia inspiration knotoflight layout links mobile psd quotes resources spotlight stock photography textures tips and tricks tutorial wallpapers
  • Literary Spring Designs

    Literary Spring Designs is primarily focused on web and graphic design, fractals, applications, and other design resources. Additional resources can be found on Literary Spring and in the Gallery.

    Knot of Light

    Knot of Light features app reviews, eBook reviews and information, iPhone/iTouch wallpapers, resources for making a website mobile friendly, and other resources for your mobile needs.

Home • Resources and Credits • Main Site • Contact

Login • Admin Powered by WordPress. Literary Spring Designs 2010