Table of Contents
CSS3 is a common name for the generation of CSS features that followed CSS 2.1. After CSS 2.1, the W3C developed parts of the language as separate modules. You write one stylesheet that can use both older CSS rules and newer features. There is no CSS3 mode to turn on.

What CSS3 added
- More precise selectors. The patterns
[attr^="value"],[attr$="value"], and[attr*="value"]match an attribute value's beginning, ending, or any part of the value. - Translucent colors. RGBA and HSLA syntax can specify an alpha value so part of the background shows through.
- Rounded corners and shadows. Use
border-radiusfor the corners,box-shadowto shadow the element's box, andtext-shadowfor the letters. - Gradients and multiple backgrounds. Use
linear-gradient()orradial-gradient()to generate a background layer. Comma-separated background layers stack with the first one on top.
Try a button with a gradient and shadow
.button {
color: white;
background: #16478c;
background: linear-gradient(#245eb0, #12346b);
border-radius: 0.5rem;
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.button:focus-visible {
outline: 2px solid #12346b;
outline-offset: 3px;
}
The first background declaration supplies a solid fallback. The two leading shadow lengths are the horizontal and vertical offsets, and the third is the blur radius. Test the result with the keyboard as well as the mouse so focus remains visible.

Choose features by browser support
Module levels are independent. A Level 4 feature in one module tells you little about the version of another. The W3C CSS Snapshot describes how the standards fit together. When deciding whether to use a property in production, check support for that specific feature in the browsers you serve.
For practice, use the web development learning path to work through selectors and responsive layout. The TipsMake programming guides include more examples to try in a small page.
Reader Comments 0
Sign in with email or Google to join the discussion.