SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Mar 2011
    0 Post(s)
    0 Thread(s)

    Difference between .h1 and #h1 selector

    what is the Difference between .h1 and #h1 selector., can we use both.,

  2. #2
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    A Maze of Twisty Little Passages
    60 Post(s)
    0 Thread(s)
    Yes you can use both the 'class selector' the one with period (.), e.g. .hello so it can occur many times in a HTML page; <p class="hello"> or <h1 class="hello">

    The CSS 'ID selector' contains a '#' immediately followed by the ID value, which must be an identifier, e.g. #hello although ID name values within (x)html must be unique and only occur once; <p id="hello"> so you couldn't have multiple ID called "hello" unlike with the class selectors.

    However, the example you have shown in post #1 isn't a very good choice for a class or ID name for it to match. I think you might be getting confused with a H1 rather than class and id names.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts