Html achieves rounded rectangle and rounded rectangle
Q: How can I use div + css and position to implement a rounded rectangle?
Solution Overview:
Content: first, add a large layer in the <body> label (the large layer is used to fix the overall large frame ), then the large layer contains four small layers (four rounded corners are placed in the four small layers (the elliptical shape is prepared with ps in advance, and then the slice tool is used to cut the image ))
Style: the css attributes set inside the
1. position: relative;
2. width and height;
3. Background Color;
4. border line (used to adjust the relative positions of the four original corners. After adjustment, you can delete the border line settings)
When setting the css of a small layer, each layer must have the following attributes:
1. position: absolute;
2. width and height;
3. Direction attributes (left, right, bottom, top)
4. background: url ("") no-repeat; (introduces the rounded corner image in each direction)
The following code implements the rounded rectangle:
<! Doctype html>
Note: The css styles used in my code are inline styles. There are three types of CSS styles: inline, embedded, and external styles.