I've already covered 30 CSS selectors that should be remembered, so what are the new attributes for the new CSS3? While most require a specific prefix, you can still use it in your project, and I encourage you to do so.
The key is to first determine whether you have any understanding of the nuances of the various browsers, you can be sure that IE shows the 90-degree angle is not smooth? It depends on your decision. But always remember that web design doesn't have to see all the different browsers. At the end of the article, we will show an interesting final case.
1, Border-radius
Border-radius is one of the most popular CSS3 properties, and Border-radius is one of the highest-level attributes in CSS3. When the designer is afraid that a layer will be displayed in a different way between different browsers, the CSS fillet, a very elementary knowledge, will guide them to start learning.
Our idea of providing a spare viewing experience for mobile browsers is very good. Oddly, when this approach appears on a desktop browser, they do not think so.
-webkit-border-radius:4px;
-moz-border-radius:4px;
border-radius:4px; |
Note: Please perform the "Border-radius" syntax in Safari 5 and IE9 browsers.
Round
Many readers may not realize that we can use this attribute to make a circle.
-moz-border-radius:50px;
-webkit-border-radius:50px;
border-radius:50px; |
If you want to add a little more effect, we can use flexible box Model (details in 8) to make the text vertically in the horizontal direction of the center. This requires a bit of code, but it's just a compensation for different browsers.
Display:-moz-box;
Display:-webkit-box;
Display:box;
-moz-box-orient:horizontal; /* The default, so not really necessary here * *
-webkit-box-orient:horizontal;
Box-orient:horizontal;
-moz-box-pack:center;
-moz-box-align:center;
-webkit-box-pack:center;
-webkit-box-align:center;
Box-pack:center;
Box-align:center; |
2, Box-shadow
Next is the very common Box-shadow, can make your element immediately beautification, just remember not to set the value too outrageous.
-webkit-box-shadow:1px 1px 3px #292929;
-moz-box-shadow:1px 1px 3px #292929;
box-shadow:1px 1px 3px #292929; |
Four parameters of Box-shadow
X-offset x Axis Offset
Y-offset Y-Axis offset
Blur Fuzzy value
Color of Shadow Shadow colors
Now, many people don't know that you can use multiple box-shadows at once, which can have some interesting effects. In the following illustration, I use blue and green shading to magnify the effect.
-webkit-box-shadow:1px 1px 3px Green, -1px-1px blue;
-moz-box-shadow:1px 1px 3px green,-1px-1px Blue;
box-shadow:1px 1px 3px Green, -1px-1px blue; |
Clever Shadows
The CSS
. box:after {
Content: ';
Position:absolute;
Z-index:-1; /* Hide Shadow behind image * *
* * The Shadow * *
-webkit-box-shadow:0 15px 20px rgba (0, 0, 0, 0.3);
-moz-box-shadow:0 15px 20px rgba (0, 0, 0, 0.3);
-box-shadow:0 15px 20px rgba (0, 0, 0, 0.3);
width:70%;
left:15%; /* One half of the remaining 30% (* * above)
height:100px;
bottom:0;
} |
3, Text-shadow