Skip to content
Related Articles
Open in App
Not now

Related Articles

CSS | [attribute^=value] Selector

Improve Article
Save Article
Like Article
  • Last Updated : 14 Jan, 2019
Improve Article
Save Article
Like Article

The [attribute^=value] selector is used to select those elements whose attribute value begins with given attribute.


[attribute^=value] {
    // CSS Property


<!DOCTYPE html> 
            CSS [attribute^="value"] Selector 
        <!-- CSS property -->
            p[class^="for"] { 
                background: green; 
                color: white; 
        <h2>[attribute^=value] Selector</h2
        <p class="GeeksforGeeks">GeeksforGeeks</div
        <p class="forGeeks">A computer science portal</div
        <p class="Geeks">Sudo GATE</p
        <p class="for">Sudo placement</p

CSS attribute Selector example output gfg

Supported Browsers: The browser supported by [attribute^=value] selector are listed below:

  • Google Chrome 4.0
  • Internet Explorer 7.0
  • Firefox 3.5
  • Safari 3.2
  • Opera 9.6
My Personal Notes arrow_drop_up
Like Article
Save Article
Related Articles

Start Your Coding Journey Now!