div#name or div #name or div id="name" ????

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Locked
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

div#name or div #name or div id="name" ????

Post by KitchM »

What is the consensus for best practices for naming?

There appears to be various methods, and the one that CMSMS templates use is div#name that the syntax highlighter does not like.

Choices:
1. div#name
2. div #name
3. div id="name"
4. other?

Thanks.
JohnnyB
Dev Team Member
Dev Team Member
Posts: 731
Joined: Tue Nov 21, 2006 5:05 pm

Re: div#name or div #name or div id="name" ????

Post by JohnnyB »

Naming is kind of a personal thing when it comes to HTML/CSS
When participating on a team, and mostly with backend code, there will be standards established.
1. div#name
2. div #name
In css, this would not be the same target.

div#MyTitle is not the same as
div #MyTitle

1) is <div id="MyTitle">Title</div>


2) is <div><p id="MyTitle">Title</p></div>
OR
<div><div id="MyTitle">Title</div></div>
OR
<div><h1 id="MyTitle">Title</h1></div>

https://generalassemb.ly/education/code ... ash-course

https://mozteach.makes.org/thimble/cras ... ml-and-css
"The art of life lies in a constant readjustment to our surroundings." -Okakura Kakuzo

--
LinkedIn profile
--
I only speak/write in English so I may not translate well on International posts.
--
KitchM
Power Poster
Power Poster
Posts: 328
Joined: Mon Dec 02, 2013 3:26 am

Re: div#name or div #name or div id="name" ????

Post by KitchM »

Why is number 1 used if the AceEditor doesn't like it? Or is it the problem of AceEditor?
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: div#name or div #name or div id="name" ????

Post by Dr.CSS »

Locked

Return to “Layout and Design (CSS & HTML)”