How to set rounded corners in css _ tutorial

Source: Internet
Author: User

Introduction
There are many different ways to do this, and many different opinions should be taken. I have a table that shows how to do this. It can be used as a division. I believe some people will feel more comfortable with division, but I chose a table mainly because I think the table is easy for beginners to understand and understand.

Using Photoshop, I created a rounded rectangle as follows:

Please make sure that your width you are looking for before continuing, regardless of the width, as you make this rectangle to be the width of your desk. I am already small. For this tutorial, the 740 and 780 pixels between places are 800*600 good audiences.

Now confirm that Photoshop is enabled in your history menu. If you do not click the menu in the window, select history. Now select the cropping tool and crop your picture so that you have left the top part to take a seat. You need to delete some gray ones.

When you click back to a step on the history toolbar, the rectangle is cropped. Now let's look at the same table structure and call for bottomimage.jpg.

At this point you may think that we can start encoding with CSS and HTML, but in this case we may be the best to open the bottom and top JPEG files, and check that they are the same width (obvious reason ). Once your happiness is the right code.

Okay, this is what I started:

<Body bgcolor = "# FFFFFF">
<Table width = "391px" align = "center" bgcolor = "# FFFFFF" cellpadding = "0" cellspacing = "0">
<Tr> <td> Top Row </td> </tr>
<Tr> <td> Content Row </td> </tr>
<Tr> <td> Bottom Row </td> </tr>
</Table>
 
</Body>

The webpage color must be the same, and the background color will not affect the rounded corner. Set cellpadding and cellspacing to zero. The pictures at the top and bottom will sit on your desk and changing these settings will undermine how they will appear.

The width table should be the same as the width of the previously created image. In my case, it's 391 pixels, but it changes significantly regardless of the size of the image.

The current style sheet. You can add it to a style sheet and append it to a webpage, but because we can only work on a page that I have added to the webpage of the first section.

<Style>
. Topimage {background-image: url(topimage.jpg );
Background-repeat: no-repeat;
Background-color: # FF7200 ;}
 
. Bottomimage {background-image: url(bottomimage.jpg );
Background-repeat: no-repeat;
Background-color: # FF7200 ;}
 
. Backcolor {background-color: # FF7200 ;}
</Style>

First-class topimage displays the jpeg value of the topimage, but it cannot be repeated. One thing is very important. This is a set, because if for any reason, you are part of the content here, and then the table image will be repeated over and over again until it reaches the desired height. This setting is no longer repeated here, but the background color settings are used to fill the space.

The first-class backcolour will only fill in the table for the row content and complete the effect.

Return to the current html:

<Body bgcolor = "# FFFFFF">
<Table width = "391px" align = "center" bgcolor = "# FFFFFF" cellpadding = "0" cellspacing = "0">
<Tr> <td height = "22px" class = "topimage"> </td> </tr>
<Tr> <td class = "backcolor"> Content Row </td> </tr>
<Tr> <td height = "20px" class = "bottomimage"> </td> </tr>
</Table>
</Body>

As you can see, I have added the relevant rows of the class and added a highly restricted top and bottom rows. The reason for this problem is that these rows are currently empty and affect the appearance of some browser columns because they are empty. If I am adding content (depending on how much), I will delete the height size of the temptation.

Because this should be your output:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.