css3 usage

WBOY
Release: 2023-05-27 10:09:38
Original
612 people have browsed it

CSS3 is an upgraded version of CSS. It adds many new features, allowing us to more flexibly control the style and effects of the page. This article will introduce the usage of CSS3 and help you better master CSS3.

  1. Embedded fonts

In CSS3, we can embed fonts using the @font-face rule. This means that we no longer need to rely on the browser's default font library, but can use our own defined fonts to achieve better page effects.

@font-face {

 font-family: "MyFont";
 src: url("myfont.ttf");
Copy after login

}

  1. Border style

In CSS3, we can use more borders Styles such as rounded borders, shadowed borders, etc. These border styles can make our pages more beautiful and unique.

border-radius: 5px; / Rounded border/
box-shadow: 2px 2px 5px #333; / Shadow border/

  1. Gradient color

The gradient color in CSS3 allows us to achieve color gradient effects more conveniently. We can define a linear gradient or a radial gradient, and set the starting color and ending color to achieve a variety of gradient effects.

background: linear-gradient(to right, red, blue); / Linear gradient/
background: radial-gradient(circle, red, blue); / Radial gradient/

  1. Telescopic layout

In CSS3, we can use flexbox layout, which allows us to implement page layout more conveniently . Flexbox layout can achieve various arrangements, such as horizontal arrangement, vertical arrangement, etc., by setting the properties of the container.

display: flex; / Set as flex container/
flex-direction: row; / Horizontally arrange /
justify-content: center; / Center alignment/

  1. Animation effect

The animation effect in CSS3 allows us to achieve a variety of animation effects, such as gradients, Rotation, movement and other effects. We can set the starting state and end state of the animation, as well as the time and curve type of the animation to achieve the animation effect we want.

animation: myanimation 2s ease-in-out; / Set animation/
@keyframes myanimation {

 from { opacity: 0; }
 to { opacity: 1; }
Copy after login

} / Define animation effect/

Summary

Through the introduction of this article, we have learned about the various uses of CSS3, including embedded fonts, border styles, gradient colors, retractable layouts and animation effects. These new features provide us with more possibilities to achieve better page effects. Of course, these are only part of the content of CSS3, and there are many more that we need to learn and master.

The above is the detailed content of css3 usage. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!