Skip to content
Related Articles

Related Articles

CSS | #id Selector

View Discussion
Improve Article
Save Article
Like Article
  • Difficulty Level : Basic
  • Last Updated : 03 Jan, 2019

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
  • Internet Explorer
  • Firefox
  • Safari
  • Opera

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!