Jump to content

Year

Day

24 Ways to impress your friends

14 12/2005 Broader Border Corners

by Patrick Griffiths

A quick and easy recipe for turning those single-pixel borders that the kids love so much into into something a little less right-angled.

Here’s the principle: We have a box with a one-pixel wide border around it. Inside that box is another box that has a little rounded-corner background image sitting snugly in one of its corners. The inner-box is then nudged out a bit so that it’s actually sitting on top of the outer box. If it’s all done properly, that little background image can mask the hard right angle of the default border of the outer-box, giving the impression that it actually has a rounded corner.

Take An Image, Finely Chopped

Magnified corner example

Add A Sprinkle of Markup

<div id="content">
     <p>Lorem ipsum etc. etc. etc.</p>
 </div>

Throw In A Dollop of CSS

#content { 
     border: 1px solid #c03;
 }

#content p { background: url(corner.gif) top left no-repeat; position: relative; left: -1px; top: -1px; padding: 1em; margin: 0; }

Bubblin’ Hot

Et voilà. Bon appétit.

Extra Toppings

About the author

Patrick Griffiths is a silverback member of London-based web woop Vivabit. He has been known to dabble in book writing and conference organising and also has a penchant for films, evolution and walking his pet website, HTML Dog.

Comments

Commenting is closed for this article.

by Patrick Griffiths

About the author

Patrick Griffiths

Patrick Griffiths has been doing the professional web developer thing since 1999, and HTML and CSS has pretty much always been his specialty. He has worked for the likes of Vodafone, Wiley, and on various UK Government projects, and has contributed a number of articles and projects to well respected web design resources.

More information

In association with:

Perch - a really little cms