Magento Expert Forum - Improve your Magento experience

Results 1 to 7 of 7

ID selector vs CLASS?

  1. #1

  2. #2
    New member erictwendell's Avatar
    Join Date
    Dec 2013
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by lara123 View Post
    What is the difference between an ID selector and CLASS?
    The id selector is used to specify a style for a single, unique element.It uses id attribute of the HTML and is given by "#". The class selector is used to specify a style for a group of elements. It is bit different from the id selector, the class selector is most often used on several elements. It is given by "."
    Actually these HTML elements are used to while designing of HTML web site.

  3. #3
    Junior Member
    Join Date
    Feb 2015
    Posts
    316
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    What is the difference between an ID selector and CLASS?

  4. #4
    Junior Member
    Join Date
    May 2015
    Posts
    50
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    Basically id use for call function for example onclick function when user click the button javascript event perform by using that id value, classes used for css style function.

  5. #5
    Junior Member
    Join Date
    Aug 2015
    Posts
    12
    Thanks
    0
    Thanked 1 Time in 1 Post

    Default

    ID should be used for large areas like wrapper, header, content, footer. It is unique.

  6. #6
    Junior Member
    Join Date
    Oct 2016
    Posts
    984
    Thanks
    1
    Thanked 4 Times in 4 Posts

    Default

    The class is used when you want to consistently style multiple elements throughout the page/site. Use a class when you want to consistently style multiple elements throughout the page/site. Classes are useful when you have, or possibly will have in the future, more than one element that shares the same style.

    ID used when you have a single element on the page that will take the style. Remember that IDs must be unique. Examples of ids are main-content, header, footer, or left-sidebar.

  7. #7
    Junior Member
    Join Date
    Apr 2017
    Posts
    132
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Default

    Nice, thanks for sharing such information.

Bookmarks

Posting Permissions

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