Is HTML case sensitive?
In an example I'm working with it says:
<!DOCTYPE html>
Would <!doctype html>
or <!DocType Html>
work differently (or not at all)?
HTML is case insensitive.
Tag names for HTML elements must exactly match the names of the elements given in the HTML elements section of this document; that is, tag names are case-sensitive.
In HTML, the attribute and tag names are case-insensitive. The close association of HTML and JavaScript can lead to confusion, so case sensitivity is more important in JavaScript. For example, HTML onclick event attribute is mentioned as onClick in HTML but should be onclick in JavaScript.
CSS selectors are generally case-insensitive; this includes class and ID selectors. But HTML class names are case-sensitive (see the attribute definition), and that's causing a mismatch in your second example.
No, but it's considered good practice to keep HTML markup lowercase.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With