Skip to content
Related Articles

Related Articles

CSS | #id Selector

View Discussion
Improve Article
Save Article
  • Difficulty Level : Basic
  • Last Updated : 12 Jul, 2022
View Discussion
Improve Article
Save Article

The #id selector is used to set the style of given id. The id attribute is the unique identifier in HTML document. The id selector is used with # character. 


#id {
    // CSS property



<!DOCTYPE html>
        <title>#id selector</title>
        <!-- CSS property using id attribute -->
            #gfg1 {
            #gfg2 {
        <!-- id attribute declare here -->
        <h1 id = "gfg1">GeeksforGeeks</h1>
        <h2 id = "gfg2">#id selector</h2>



Supported Browsers: The browser supported by id selector are listed below:

  • Google Chrome 1 and above
  • Edge 12 and above
  • Internet Explorer 3 and above
  • Firefox 1 and above
  • Safari 1 and above
  • Opera 3.5 and above
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!