Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
Like Tree2Likes
  • 1 Post By Ronald Roe
  • 1 Post By karelchudej

Thread: CSS - classes instead of IDs mostly for headers, footers etc?

  1. #1
    Junior Member
    Join Date
    Dec 2016
    Posts
    17
    Member #
    55967
    Liked
    1 times

    CSS - classes instead of IDs mostly for headers, footers etc?

    Hi guys, I posted an image of the code for my new website, and someone suggested I use classes mostly What say you?
    Thanks!
    Here is my code, currently

    Pretty Codes.jpg

  2.  

  3. #2
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Most people use classes. It's been hotly debated in the past, but I don't think it matters. I almost never use IDs, because that's just the pattern I'm comfortable with. As long as it works for you, there's nothing wrong with using mostly IDs.
    ScottAC likes this.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  4. #3
    Junior Member
    Join Date
    Jun 2017
    Posts
    4
    Member #
    56774
    Liked
    1 times
    I think that it matters. ID has 100 times bigger weight in css coding in contrary of the class. Also ID's should be unique so if you have more elements with the same ID you should use class instead. IMHO for css styling you should always use classes.
    ScottAC likes this.

  5. #4
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Quote Originally Posted by karelchudej View Post
    I think that it matters. ID has 100 times bigger weight in css coding in contrary of the class. Also ID's should be unique so if you have more elements with the same ID you should use class instead. IMHO for css styling you should always use classes.
    You didn't actually make an argument for either side. You just stated general rules regarding usage of classes and IDs. This is why I don't think it matters. No one can actually come up with a viable argument.

    Also, ID is only 1 level higher in specificity than class, not 100.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  6. #5
    Junior Member
    Join Date
    Jun 2017
    Posts
    4
    Member #
    56774
    Liked
    1 times
    Quote Originally Posted by Ronald Roe View Post
    You didn't actually make an argument for either side. You just stated general rules regarding usage of classes and IDs. This is why I don't think it matters. No one can actually come up with a viable argument.

    Also, ID is only 1 level higher in specificity than class, not 100.
    So you can override ID by two classes ? That is not true. Based on this general rules he can makes a decision.

  7. #6
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Quote Originally Posted by karelchudej View Post
    So you can override ID by two classes ? That is not true. Based on this general rules he can makes a decision.
    That's not what I said at all. You maybe need to go back to the specs and see how specificity works.

    You can, however override an ID with 256 classes.
    Last edited by Ronald Roe; Jun 16th, 2017 at 04:43 PM.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:12 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com