Files
clarkeis.com/site/introwebdev/week-2-doctypes.html
Tyler Clarke 691974d96b
All checks were successful
ClarkeIS Build / Build-Docker-Image (push) Successful in 23s
week 2
2026-01-14 11:51:46 -05:00

36 lines
1.5 KiB
HTML

[!]
[=title "Week 2: Doctypes"]
[=content-]
<p>
<i>This is only a part of week 2 - make sure to read through all of the companion pieces!</i>
</p>
<p>
So far we've been doing HTML pretty minimally: we just open a text file, write some tags, save, and reload.
This is all well and good, but there's a subtlety: when you just enter html immediately, the browser
<i>has no idea what you're doing</i>. Browsers are pretty smart, so it <i>guesses</i> (by the filename,
and by the presence of tags) that it's HTML, but the browser also guesses that you aren't really using
HTML properly, and so some features are broken!
</p>
<p>
This situation is known as <i>quirks mode</i>. It's actually mostly fine - most of the features that it breaks are pretty obscure -
but to maintain full compatibility and avoid weird bugs, we should always declare an HTML5 doctype. In fact this is very easy. Just include the following
tag at the top of all of your html files:
<pre><code>&lt;!DOCTYPE html&gt;</code></pre>
</p>
<p>
This will put your page into standards mode, ensuring correct HTML5 non-quirks behavior.
Do not include any text on the same line, so your files should look like
</p>
<pre><code>&lt;!DOCTYPE html&gt;
&lt;h1&gt;Header!&lt;/h1&gt;</code></pre>
<p>
Instead of
</p>
<pre><code>&lt;!DOCTYPE html&gt;&lt;h1&gt;Header!&lt;/h1&gt;
</code></pre>
<p>
I <b>will not accept</b> any homeworks that don't have a correct doctype. Make sure to memorize the pattern!
</p>
[/]
[#template.html]