Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3723282
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T06:12:49+00:00 2026-05-19T06:12:49+00:00

What are the different usages for the # , . , and > symbols

  • 0

What are the different usages for the #, ., and > symbols and what do they reference?

For example, I know these two:

div#id {}     // <div id="id" />
div.class {}  // <div class="class" />

However, there are others which I don’t understand:

div#id element
div#id>element
div#id.class
div#id .class
div#id>element#id .class

Any insights?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T06:12:51+00:00Added an answer on May 19, 2026 at 6:12 am

    As pst says, you should really read up more on your own. I’ll add that you can experiment using Firebug or an online tool like jsFiddle to see live results. But I understand not everyone combines ID and class selectors, and the fact that your selectors are so similar and bunched like that can be confusing, so here goes:

    The > symbol is called the child combinator, and is different from whitespace (the descendant combinator) in that > only looks one level deep in the DOM hierarchy.

    Compare the first two selectors:

    • div#id element /* With a space */

      Select an element
      which descends from (is contained anywhere within) a div of id="id".

      Would match either of these:

      <div id="id">
          <element />
      </div>
      

      <div id="id">
          <div class="class">
              <element />
          </div>
      </div>
      
    • div#id>element /* With a > sign */

      Select an element
      which is a child of (is contained directly within) a div of id="id".

      Will only match this:

      <div id="id">
          <element />
      </div>
      

      But not this because there is an intermediate div.class occurring between element and div#id:

      <div id="id">
          <div class="class">
              <element />
          </div>
      </div>
      

    Because the space represents the descendant combinator, it’s significant in CSS selector syntax (except when used between other combinators and simple selectors, e.g. E > F and E>F are the same).

    Compare the next two selectors:

    • div#id.class /* No spaces anywhere */

      Select a div of both id="id" and class="class".

      By omitting the space, you are chaining three things together:

      1. The element selector (div),

      2. The ID selector (#id), and

      3. The class selector (.class).

      Thus a single element must satisfy all three selectors in order to be targeted by its rule. In HTML, this means it has to have both attributes, like so: <div id="id" class="class">

    • div#id .class /* With a space */

      Select any element of class="class"
      which descends from a div of id="id".

      Notice the whitespace separating div#id and .class. This means .class applies to a totally different element.

      Would match either of these:

      <div id="id">
          <p class="class"></p>
      </div>
      

      <div id="id">
          <div>
              <p class="class"></p>
          </div>
      </div>
      

      But nothing here will be matched because there’s no .class to look for within div#id:

      <div id="id">
          <element />
      </div>
      

      And not this either, for the same reason:

      <div id="id" class="class"></div>
      

    The last selector just involves putting it all together:

    • div#id>element#id .class

      Funnily enough, the corresponding HTML structure would be invalid because you can’t have more than one element with the same ID, but anyway:

      Select any element of class="class"
      which descends from an element of of id="id"
      which is a child of a div of of id="id".

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the differences between a {...} and a:link{...} ? Are there different usages,
I don't know if there's a different Css usage in Asp.net but I just
While reset and checkout have different usages most of the time, I can't see
Is there a difference in usage between class Helper class << self # ...
Are these actually three different concepts or am I getting jumbled? (I've been reading
I have two different-sized monitors, connected together using (I believe) TwinView. I tried System.out.println(Toolkit.getDefaultToolkit().getScreenSize());
The MFC CArray class has two template parameters (from MSDN ): template < class
Is there a comprehensive comparison of different versions of DirectX, different versions of shaders?
const std::string s1(foo); const std::string& s2(foo); Not sure how they are different but I'm
When different threads access a static method, are objects declared in that method local

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.