Rounded Borders in IE9 with Gradient Background

Here’s a fix for using rounded borders in IE9 if your background is a gradient.

HTML

The content needs to be wrapped with an element that also has rounded corners applied, and hides the overflow of the edges.

<div class="round mask">
	<div class="round gradient">
		Insert your content here.
	</div>
</div>

CSS

Edit the .round class to change the border-radius size, as well as the .gradient class to change the css3 gradient colors.

.mask {
	overflow: hidden;
}

.round {
	-webkit-border-radius: 5px;
	-moz-border-radius: 5px;
	border-radius: 5px;
}

.gradient {
	background: rgb(254,255,255); /* Old browsers */
	background: -moz-linear-gradient(top,  rgba(254,255,255,1) 0%, rgba(204,204,204,1) 100%); /* FF3.6+ */
	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(254,255,255,1)), color-stop(100%,rgba(204,204,204,1))); /* Chrome,Safari4+ */
	background: -webkit-linear-gradient(top,  rgba(254,255,255,1) 0%,rgba(204,204,204,1) 100%); /* Chrome10+,Safari5.1+ */
	background: -o-linear-gradient(top,  rgba(254,255,255,1) 0%,rgba(204,204,204,1) 100%); /* Opera 11.10+ */
	background: -ms-linear-gradient(top,  rgba(254,255,255,1) 0%,rgba(204,204,204,1) 100%); /* IE10+ */
	background: linear-gradient(to bottom,  rgba(254,255,255,1) 0%,rgba(204,204,204,1) 100%); /* W3C */
	filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#feffff', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
}

Leave a Reply

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