Jump to content
Sign in to follow this  
Shadow

Proper Use Of Id And Class

Recommended Posts

OK, so a question mainly about the use of the id class and if something would be proper use or a bad practice as far as coding goes. In an attempt to streamline stuff even further I have been recoding my site and I have been thinking about adding an id tag to the body of some pages. This would of course allow me to set custom css for those specific pages.Examples:<body id="creatures"><body id="core-classes">etc, etc.. Or would it be more proper to just create an extra <div> with the id tags--or a class tag-- inside of the main content div for that section and go that way.Examples: (article being the primary container for that section with all the positioning/etc data for the container)<div id="articles"> <div id="creatures"> --insert content entry here-- </div></div> OR <div id="articles"> <div class="creatures"> --insert content entry here-- </div></div> I've read a few things on it and some seem to be for it and some against it but the articles I've found are fairly old so need some fresh thoughts on it.

Share this post


Link to post
Share on other sites

I wouldn't add an extra <div> if I wanted to target one specific page. Giving the ID to the body is better.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...