CSS3 PIE

CSS3 PIE is an HTC file that allows you to use standard CSS3 (plus vendor prefixes) to get features such as linear background gradients, rounded corners and drop-shadows in all browsers. HTC files are applied using a behavior in your CSS, which is IE-only, and does not validate.

#example1 {
	-moz-border-radius: 15px; /* Firefox */
	-webkit-border-radius: 15px; /* Safari, Chrome */
	border-radius: 15px; /* Opera, IE9+, W3C */
	/* fix bg bleed: http://tumble.sneak.co.nz/post/928998513/fixing-the-background-bleed */
	-moz-background-clip: padding;
	-webkit-background-clip: padding-box;
	background-clip: padding-box;
}
html.lte8 #example1 {
	behavior: url('../../wp-content/themes/practicalcss3/css3-pie.htc'); /* IE6-8 */
	zoom: 1; /* 'hasLayout' required for HTC method */
}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

We can create a cool looking button:

#example2 a {
	background: #e07;
	border: 2px solid #000;
	color: #000;
	display: inline;
	padding: 2px 8px;
	-moz-border-radius: 15px; /* Firefox */
	-webkit-border-radius: 15px; /* Safari, Chrome */
	border-radius: 15px; /* Opera, IE9+, W3C */
	/* fix bg bleed: http://tumble.sneak.co.nz/post/928998513/fixing-the-background-bleed */
	-moz-background-clip: padding;
	-webkit-background-clip: padding-box;
	background-clip: padding-box;
}
#example2 a:hover {
	color: #fff;
}
html.lte8 #example2 a {
	behavior: url('../../wp-content/themes/practicalcss3/css3-pie.htc'); /* IE6-8 */
	zoom: 1; /* 'hasLayout' required for HTC method */
}

Or even a sticker:

#example3 a {
	background: #e07;
	border: 2px solid #000;
	color: #000;
	display: block;
	width: 58px;
	line-height: 58px;
	text-align: center;
	vertical-align: middle;
	-moz-border-radius: 30px; /* Firefox */
	-webkit-border-radius: 30px; /* Safari, Chrome */
	border-radius: 30px; /* Opera, IE9+, W3C */
	/* fix bg bleed: http://tumble.sneak.co.nz/post/928998513/fixing-the-background-bleed */
	-moz-background-clip: padding;
	-webkit-background-clip: padding-box;
	background-clip: padding-box;
}
#example3 a:hover {
	color: #fff;
}
html.lte8 #example3 a {
	behavior: url('../../wp-content/themes/dark_and_stormy/css3-pie.htc'); /* IE6-8 */
	zoom: 1; /* 'hasLayout' required for HTC method */
}

One Response to CSS3 PIE

  1. aarontgrogg says:

    Updated:
    Changed the CSS selector from html.ie to html.lte8 to prevent CSS3 Pie from affecting IE9+, since they already understand border-radius.
    Re-ordered the declarations to list the W3C-version last, so as browser implement the standard, it will be the one that affects page elements.

    Cheers,
    Atg

Leave a Reply

Your email address will not be published. Required fields are marked *