Making IE have more than one background per element


Thanks to IE being a crappy browser we can hack it to do actually some interesting things. One being more than one background per element. For instance, to a single unique <div> you can give it more than one background. We can do this by utilizing IE’s filters.
Here’s an example, You can see two pictures if you have IE:
Here’s how:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<title>ie backgrounds</title>
	</head>
	<body>
		<style type="text/css">
			div {
				background: url(../../image/ieBackground/digg.png);
				height: 200px;
				width: 200px;
			}
			/* must be a different coding specificity */
			body div {
				filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=scale, src='../../image/ieBackground/icon.png');
			}
		</style>
		<div></div>
	</body>
</html>

That’s it!

Share and Enjoy:
  • Print
  • Digg
  • StumbleUpon
  • Slashdot
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Share/Bookmark
  1. No comments yet.
(will not be published)