Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a div with rounded corners

Tags:

How do you make a div so that its border corners are rounded?

like image 949
user23557676 Avatar asked Aug 18 '11 11:08

user23557676


People also ask

How do I create a div curved border?

If we want to apply only margin side border-radius then CSS provides predefined properties. border-top-left-radius: 10px: apply border-radius 10px to top-left side. border-top-right-radius: 10px: apply border radius 10px to top-right side. border-bottom-left-radius: 10px: apply border radius 10px to bottom-left side.

What CSS property gives rounded corners?

The border-radius CSS property rounds the corners of an element's outer border edge.

How do you add rounded corners to a table in CSS?

Use the CSS border-radius property to add rounded corners to the table cells.


4 Answers

Here it is:

<style type="text/css">
div.test
{
    width: 115px;
    padding: 10px;
    border: 2px solid #000;
    border-radius: 15px;
    -moz-border-radius: 15px;
}
</style>
<div class="test">This is some text!</div>
like image 171
SilverHorn Avatar answered Sep 29 '22 13:09

SilverHorn


Use the border-radius property. The higher the specified amount (typically in px), the more rounded your shape. Example:

myDiv { border-radius:30px;}

Hope that helps.

like image 30
aaplmath Avatar answered Sep 29 '22 13:09

aaplmath


add this css:

border-top-right-radius:15px;
border-top-left-radius:15px;
border-bottom-right-radius:15px;
border-bottom-left-radius:15px;
like image 36
sleepyup Avatar answered Sep 29 '22 12:09

sleepyup


With CSS add the code: border-radius: 10px.

I use 10px for example, but you can experiment with however amount of pixels you like.

like image 25
kriscross07 Avatar answered Sep 29 '22 12:09

kriscross07