CSS [attribute^=value] Selector Last Updated : 29 Aug, 2024 Comments Improve Suggest changes Like Article Like Report The [attribute^=value] selector selects elements whose attribute value begins with a given attribute.Syntax:[attribute^=value] { // CSS Property}Example: In this example, The CSS selector p[class^="for"] targets <p> elements with a class attribute that starts with "for" and applies a green background color and white text color. html <!DOCTYPE html> <html> <head> <title> CSS [attribute^="value"] Selector </title> <!-- CSS property --> <style> p[class^="for"] { background: green; color: white; } </style> </head> <body> <h2>[attribute^=value] Selector</h2> <p class="GeeksforGeeks">GeeksforGeeks</p> <p class="forGeeks">A computer science portal</p> <p class="Geeks">Sudo GATE</p> <p class="for">Sudo placement</p> </body> </html> Output:Supported Browsers: The browser supported by [attribute^=value] selectors are listed below:Google Chrome 4.0Internet Explorer 7.0Firefox 3.5Safari 3.2Opera 9.6 Comment More infoAdvertise with us R roshalmoraes Follow Improve Article Tags : Web Technologies CSS CSS-Selectors Explore CSS Introduction 3 min read CSS Syntax 2 min read CSS Selectors 7 min read CSS Comments 2 min read CSS Colors 5 min read CSS Borders 5 min read CSS Margins 4 min read CSS Height and Width 4 min read CSS Outline 4 min read CSS Fonts 4 min read Like