CSS3 [attribute^=value]Selectors
Complete CSS Selector Reference Manual
Example
Set the background color of all div elements whose class attribute value starts with "test":
div[class^="test"]
{
background:#ffff00;
}
{
background:#ffff00;
}
Try it Yourself »
Definition and Usage
The [attribute^=value] Selector matches elements whose attribute value starts with the specified value.
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support [attribute^=value] Selector.
Note:[attribute^=value] works in IE8, must be declared<!DOCTYPE>
More Examples
Example
Set the background color of all elements whose class attribute value starts with "test":
[class^="test"]
{
background:#ffff00;
}
{
background:#ffff00;
}
Try it Yourself »
other extensions