Welcome to Bucaro TecHelp!

Bucaro TecHelp
HTTPS Encryption not required because no account numbers or
personal information is ever requested or accepted by this site

About Bucaro TecHelp About BTH User Agreement User Agreement Privacy Policy Privacy Site Map Site Map Contact Bucaro TecHelp Contact RSS News Feeds News Feeds

Create a Cool Picture Frame Effect with CSS

By setting the CSS border-color property to a transparent color, and setting the background-origin property to border-box you can create a cool picture frame effect. Setting the background-origin property to border-box causes the upper-left corner of the background image to be in the upper-left corner of the border.

W3C box model

In the W3C box model, the width and height that you specify refers only to the content area of the box. So if you use background-origin:border-box to move the upper-left corner of your image to the upper-left corner of the boarder, you have to subtract 2 x the border-width from the width and height of your image to get the width and height of the box.

border-color:rgba(0, 0, 0, 0.2);
margin:0 auto;

<div id="div2"></div>

For example the image shown above has a width of 360px and a height of 465px, so after specifying a border-width of 50px, I have to set the box width to 260px, and the box height to 356px.

Note the use of the background:url method to load the image, and the use of rgba to specify a border color of black with an alpha parameter of 0.2 (alpha is a number between 0.0 (fully transparent) and 1.0 (fully opaque).

More Easy Cascading Style Sheets:
• Using Google Fonts
• Add Style to Your Blockquotes
• Write Style Rules to Make Them Understandable
• How to Color Alternating Rows or Columns in a Table
• The CSS Box Model
• How to Center a DIV Within a DIV
• Understanding CSS Positioning
• How to Style a Table
• Create Custom Horizontal Rules
• Easy CSS Popup Windows

RSS Feed RSS Feed

Follow Stephen Bucaro Follow @Stephen Bucaro

Fire HD
[Site User Agreement] [Privacy Policy] [Site map] [Search This Site] [Contact Form]
Copyright©2001-2024 Bucaro TecHelp 13771 N Fountain Hills Blvd Suite 114-248 Fountain Hills, AZ 85268