class
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Assigns a class name or set of class names to an element. You may assign the same class name or names to any number of elements, however, multiple class names must be separated by whitespace characters.
An element's class name serves two key roles:
- As a style sheet selector, for when an author assigns style information to a set of elements.
- For general use by the browser.
You can use this class to style SVG content using CSS.
Usage context
| Categories | None |
|---|---|
| Value | <list-of-class-names> |
| Animatable | Yes |
Example
Elements
The following elements can use the class attribute:
<a><circle><clipPath><defs><desc><ellipse><feBlend><feColorMatrix><feComponentTransfer><feComposite><feConvolveMatrix><feDiffuseLighting><feDisplacementMap><feFlood><feGaussianBlur><feImage><feMerge><feMorphology><feOffset><feSpecularLighting><feTile><feTurbulence><filter><foreignObject><g><image><line><linearGradient><marker><mask><path><pattern><polygon><polyline><radialGradient><rect><stop><svg><switch><symbol><text><textPath><title><tspan><use>
Specifications
| Specification |
|---|
| Scalable Vector Graphics (SVG) 2 # ElementSpecificStyling |