HTML CSS examples for CSS Selector:attribute starts with word
The [attribute|=value] selector selects elements whose attribute starts with the specified word.
The word must be a whole word, like lang="en", or followed by a hyphen( - ), like lang="en-us".
Select and style elements, where the class attribute's value starts with "top":
<!DOCTYPE html> <html> <head> <style> [class|=top] { background: red; } </style><!--from w w w. ja v a2s . c o m--> </head> <body> <h1 class="top-header">Welcome</h1> <p class="top-text">Hello world!</p> <p class="content">Are you <span class='top'> learning CSS</span>?</p> </body> </html>