Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

What Is CSS3? How CSS Changed After CSS 2.1

Understand what CSS3 means, how CSS modules are versioned, and how selectors, rounded corners, shadows, and gradients work in practice.

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 is CSS3? What's new and different from traditional CSS? Picture 1
CSS3 is the name commonly associated with the shift to independently developed CSS modules.

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-radius for the corners, box-shadow to shadow the element's box, and text-shadow for the letters.
  • Gradients and multiple backgrounds. Use linear-gradient() or radial-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.

What is CSS3? What's new and different from traditional CSS? Picture 2
Older and newer CSS rules can appear in the same stylesheet.

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.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.