|
Project Information
Featured
|
Solution for styled corners with png images, which is browser compatible. I used unitpngfix for alpha transparency in IE 6. | 8 images | Used for corners and sides | 2kb | | png_corner.css | styles for rounded corner | 912b | | unitpngfix.js | Javascript for ie png hack | 956b | | Total | ~ 4kb |
Why use png corner- It is browser compatible(works in IE 6/7, FireFox 3, Opera 9, Chrome 1.x)
- It’s small(less than 4kb)
- Easy to use(Just follow 3 easy steps)
- Can use png transparency feature so that you can create your own styled box.
- Same behavior across browsers
- You can change images from css
Limitations- It uses table for the structure of rounded corner. So your rounded corner is not as flexible as div layout (It is a small sacrifice for IE 6 png transparency)
- The images at left, right, top and bottom will be scaled not repeated. As Microsoft.Alpha filter do not support repeating.
UsageHere is a simple "How To" to use png corners. - Add png_corner.css in page
- Add html structure for rounded corner, which looks like this,
<table class="roundedCorner" border="0" cellpadding="0" cellspacing="0">
<tr>
<td class="top_left"></td>
<td class="top"></td>
<td class="top_right"></td>
</tr>
<tr>
<td class="left"></td>
<td class="content">
The content goes here :)
</td>
<td class="right"></td>
</tr>
<tr>
<td class="bottom_left"></td>
<td class="bottom"></td>
<td class="bottom_right"></td>
</tr>
</table> - Add png hack css in header as shown bellow so that the script is only added for Internet Explorer 6.
<!--[if IE 6]>
<script type="text/javascript" src="scripts/unitpngfix.js"></script>
<![endif]--> - Add clear.gif in root_file/images
And you should be good to go :) CautionWhen you load you content from ajax call or create your content dynamically after your page is loaded then you have to call the following javascript after you have done loading your content. if(pngfix) pngfix(); You should be up and running. You can download source code. It comes with a simple example.
|