Skip to content

Commit 5ac8b60

Browse files
authored
Move the ID and Class Name sections to be together
This change was made to the internal style guide a while ago to make it easier to find related sections also containing IDs and class name guidance.
1 parent 2dcaf50 commit 5ac8b60

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

htmlcssguide.html

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,41 @@ <h4 id="ID_and_Class_Name_Style" class="numbered">ID and Class Name Style</h4>
530530
.author {}
531531
</code></pre>
532532

533+
<h4 id="ID_and_Class_Name_Delimiters" class="numbered">ID and Class Name Delimiters</h4>
534+
535+
<p>Separate words in ID and class names by a hyphen.</p>
536+
537+
<p>Do not concatenate words and abbreviations in selectors by any characters
538+
(including none at all) other than hyphens, in order to improve understanding
539+
and scannability.</p>
540+
541+
<pre><code class="language-css bad">/* Not recommended: does not separate the words “demo” and “image” */
542+
.demoimage {}
543+
544+
/* Not recommended: uses underscore instead of hyphen */
545+
.error_status {}
546+
</code></pre>
547+
548+
<pre><code class="language-css good">/* Recommended */
549+
#video-id {}
550+
.ads-sample {}
551+
</code></pre>
552+
553+
<h4 id="Prefixes" class="numbered">Prefixes</h4>
554+
555+
<p>Prefix selectors with an application-specific prefix (optional).</p>
556+
557+
<p>In large projects as well as for code that gets embedded in other projects or on
558+
external sites use prefixes (as namespaces) for ID and class names. Use short,
559+
unique identifiers followed by a dash.</p>
560+
561+
<p>Using namespaces helps preventing naming conflicts and can make maintenance
562+
easier, for example in search and replace operations.</p>
563+
564+
<pre><code class="language-css good">.adw-help {} /* AdWords */
565+
#maia-note {} /* Maia */
566+
</code></pre>
567+
533568
<h4 id="Type_Selectors" class="numbered">Type Selectors</h4>
534569

535570
<p>Avoid qualifying ID and class names with type selectors.</p>
@@ -614,41 +649,6 @@ <h4 id="Hexadecimal_Notation" class="numbered">Hexadecimal Notation</h4>
614649
color: #ebc;
615650
</code></pre>
616651

617-
<h4 id="Prefixes" class="numbered">Prefixes</h4>
618-
619-
<p>Prefix selectors with an application-specific prefix (optional).</p>
620-
621-
<p>In large projects as well as for code that gets embedded in other projects or on
622-
external sites use prefixes (as namespaces) for ID and class names. Use short,
623-
unique identifiers followed by a dash.</p>
624-
625-
<p>Using namespaces helps preventing naming conflicts and can make maintenance
626-
easier, for example in search and replace operations.</p>
627-
628-
<pre><code class="language-css good">.adw-help {} /* AdWords */
629-
#maia-note {} /* Maia */
630-
</code></pre>
631-
632-
<h4 id="ID_and_Class_Name_Delimiters" class="numbered">ID and Class Name Delimiters</h4>
633-
634-
<p>Separate words in ID and class names by a hyphen.</p>
635-
636-
<p>Do not concatenate words and abbreviations in selectors by any characters
637-
(including none at all) other than hyphens, in order to improve understanding
638-
and scannability.</p>
639-
640-
<pre><code class="language-css bad">/* Not recommended: does not separate the words “demo” and “image” */
641-
.demoimage {}
642-
643-
/* Not recommended: uses underscore instead of hyphen */
644-
.error_status {}
645-
</code></pre>
646-
647-
<pre><code class="language-css good">/* Recommended */
648-
#video-id {}
649-
.ads-sample {}
650-
</code></pre>
651-
652652
<h4 id="Hacks" class="numbered">Hacks</h4>
653653

654654
<p>Avoid user agent detection as well as CSS “hacks”—try a different approach

0 commit comments

Comments
 (0)