Web Design Articles

Adding Rounded Corners to HTML with CSS

Web Design Articles

Submit a Web Design Article


Web Design Articles    |    Code    |    CSS

Here you will find articles about Web Design, Web Site Accessibility, Web Standards and Internet Marketing. If you would like to have an article you have written published on this site please use the form above to submit your article for publication. If your article is published, you will receive a credit with a byline linked to your website URL.


   Article

Adding Rounded Corners to HTML with CSS

by Matthew David


As the name implies, a Cascading Style Sheet, or CSS, is a document that describes the visual style of your content. Web designers have been leveraging Cascading Styles Sheets as a tool to control content placement and text presentation in web pages for over ten years.


With the advent of Web 2.0 applications, it is even more important to add control to your designs. The Webkit open source project, used in Apple’s Safari and Google’s Chrome, and Mozilla’s FireFox, recognize that CSS must be flexible enough to meet your design needs. To this end, there is now included in the latest versions advanced CSS styles. One of these new features is the ability to add rounded corners to objects.


Adding rounded corners is not a new technique for the web. The effect, however, is created through using images and tables to create the illusion of rounded corners. Adding images to the pages ensures that the page takes longer to load and makes modifying the page later more complex.


A simpler approach is to use the proposed Corner-Radius CSS definition that is currently supported in FireFox 3.0, Safari 3.0, Mobile Safari on your iPhone/iPod Touch and Google’s Chrome. The Corner-Radius definition is line you can add to your CSS style. The following HTML code has a style embedded that changes the presentation of the block of text to have rounded corners with a heavy, red outline:


The code would be as follows:

<p style="margin: auto; width: 500px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border: 4px solid #990000; padding: 20px;">Paragraph goes here</p>


Paragraph goes here


posted on Sep 10, 2009

   Topics



   Google


Web Design Articles    |    Code    |    CSS