PrintedExistence[dot]com



Graphics Tutorials



Donate


All this information & code is provided completely free of charge, but if you have some spare money, and wish to send me some for my trouble, please hit the button below!




JukeBox



Sponsor Ads





Tutorial: Making Rounded Corners



Theres a couple of ways of doing this.


Simple Boxes

The very simplest is to draw your rounded box in a [ grafix program ] (most have a rounded box shape tool) and set it as a table background:

<table width="200px" height="150px" cellpadding="10" background="http://www.path/to/your_image.gif"><tr> <td align="center">Your Text and Stuff</td></tr></table>


Look how easy this is!

But there are a couple of drawbacks to this method, like that your background graphic may be quite big, and take a while to load. Also if you want another box, or to resize your box its completely back to the drawing board. Perhaps a stretchy box would be better...

top




Stretchy Solid Boxes

First solid colored stretchy boxes. This time rather than drawing an entire rounded box in photoshop, just draw yourself some corners:

top left   bottom left   top right   bottom right

(if you cant draw your own corners I provide a bunch of downloadable ones at the bottom of this page)

To make your table the same color as the corners, you need to know the hex code of your corners. To find the hex code of a color youre using in your graphics program, just click on the color palette and look for a 6 digit code preceeded by a #. The hex code for my corners above is #ccccff. Now all you need is the code:

<table width="200px" height="150px" cellpadding="0" cellspacing="0"><tr>
<td><img src="http://path/to/topleft.gif" width="29px" height="30px"></td>
<td width="100%" bgcolor="#ccccff"></td>
<td><img src="http://path/to/topright.gif" width="29px" height="30px"></td>
</tr><tr>
<td height="100%" bgcolor="#ccccff"></td>
<td height="100%" bgcolor="#ccccff"></td>
<td height="100%" bgcolor="#ccccff"></td>
</tr><tr>
<td><img src="http://path/to/bottomleft.gif" width="29px" height="30px"></td>
<td width="100%" bgcolor="#ccccff"></td>
<td><img src="http://path/to/bottomright.gif" width="29px" height="30px"></td>
</tr></table>


What it effectively does, is arrange your corners in a table like this:

top left top right
Except the table created by that code doesnt have a border like this one!
bottom left bottom right


So all you see...

top left top right
...is this!
bottom left bottom right


top




Bordered Stretchy Boxes

But what if you dont want an entirely colored box...


top left top right
..how about a bordered one?
bottom left bottom right


The code for that is a bit different because you need graphic side bits as well. First make your corners:

top left   bottom left   top right   bottom right


A good way to do corner graphics is to draw a rounded box, and then a smaller rounded box inside it.

To make the side bits you can just crop off the bottom bit of one of your corners...

cropping


For instance the bit cropped off the image above will be used as a repeating background all down the left side of your box, get it?

Once youve got your corners, and left, right, top and bottom side bits the code is:

<style type="text/css">
.top { background: #ffffff url('http://path/to/top.gif'); }
.bottom { background: #ffffff url('http://path/to/bottom.gif'); }
.left { background: #ffffff url('http://path/to/left.gif'); }
.right { background: #ffffff url('http://path/to/right.gif'); }
.top, .bottom { width: 100%; background-repeat: repeat-x; }
.left, .right { height: 100%; background-repeat: repeat-y; }
</style>

<table width="200px" height="150px" cellpadding="0" cellspacing="0"><tr>
<td><img src="http://path/to/topleft.gif"></td>
<td class="top"></td>
<td><img src="http://path/to/topright.gif"></td>
</tr><tr>
<td class="left"></td>
<td height="100%" align="center"> Your Stuff Here ! </td>
<td class="right"></td>
</tr><tr>
<td><img src="http://path/to/bottomleft.gif"></td>
<td class="bottom"></td>
<td><img src="http://path/to/bottomright.gif"></td>
</tr></table>


top




Putting Scrollboxes Inside

To stick a scrolling box inside one of your rounded boxes


top left top right



like this ...
bottom left bottom right


You just need to add a bit more code inside the center td (where you would write your text). The extra code is:

<div style="width: 150px; height: 100px; overflow: auto;">Your stuff here!</div>


Remember, with overflow: auto; the scroll arrows dont appear until theres too much stuff to fit in the box so if you just write one sentence you wont see any scrolly arrows! You could write overflow: scroll; to make both horizontal and vertical scrollbars show up all the time, or overflow- y: scroll; if you just want to see the vertical arrow.

top




Readymade Corner Packs to Download


For white backgrounds:
solid purple on white download
Download
bordered purple on white download
Download
solid pink on white download
Download
bordered pink on white download
Download
solid orange on white download
Download
bordered orange on white download
Download


For black backgrounds:
solid green on black download
Download
bordered gray on black download
Download
solid red on black download
Download
bordered red on black download
Download




<< back to grafix tutorials

top
All content copyright PrintedExistence.com 2006 - 2007 ©
PrintedExistence.com is a subsidiary of StephensPhoto™

W3c Valid XHTML  W3c Valid HTML  W3c Valid Css  Get Macromedia Flash Player  Viewable With Any Browser  PHP Powered  MySql Powered
preloading...