HTML tips for 90s kids trying to make 20s websites, metadata edition 

  • <!DOCTYPE html>: you have the modern HTML standard at html.spec.whatwg.org/ bookmarked now, you're not making terrible Microsoft Internet Explorer 5-only broken pages, the browser doesn't have to use ~*~quirks mode~*~. Stick this at the very top.
  • <html lang="en">: If most of the page is in one language - this one is English - then you can tell the browser that so language-dependent stuff can use that. Use the ISO 639 abbreviations. I think. (Correction: BCP 47, not ISO 639. It's a subset, I think.) Anyway, if part of your page is in another language, you can put lang="whatever" on the element containing the other-language part. (Or, like, wrap it in <span lang="whatever"></span> if you don't have one.)
  • <meta charset="UTF-8">: Did you make your HTML files using UTF-8? It should be an option in, like, the Save As dialog or something. Anyway, if you did, you can put this in the <head></head> part so the browser knows it's not Windows-1252 or something.
    • Edit: If your server declares a character encoding in an HTTP header, this line will do nothing. It looks like Neocities doesn't do it for our site, though, so we still need it.
  • <meta name="viewport" content="width=device-width, initial-scale=1">: Okay, so, you didn't use any tables for layout, right? And you still don't understand CSS or Javascript? Okay, then your website probably works fine on, like, a tiny screen. You can check this by zooming in like 500% or opening it in a small window or, idk, both. Anyway, the viewport thing tells mobile browsers that they can just display your site normally and it'll all be good.

Folks who learned HTML in the past fifteen years, feel free to chime in with more hot tips. Because we need them. Please.

character encodings re: HTML tips for 90s kids trying to make 20s websites, metadata edition 

@Packbat the charset <meta> tag is the last‐resort option; browsers will look at the Content-Type provided by the server first, so specifying it does nothing UNLESS your server doesn’t specify a content type. also, if you write XHTML, UTF-8 is the default option because all XML defaults to UTF‐8. if you’re the type of person who always closes your tags anyway, you might as well just write XHTML and save yourself some trouble

(XHTML is also distinguished from HTML by its content‐type; be sure to use an extension which your web browser will serve as XML not as HTML if you go this route)

re: character encodings re: HTML tips for 90s kids trying to make 20s websites, metadata edition 

@Packbat *unless your server doesn’t specify a charset parameter in the content‐type, lol

re: character encodings re: HTML tips for 90s kids trying to make 20s websites, metadata edition 

@Lady I actually have no idea how to check that! We're gonna edit a note into the OP, though, because that seems important

Follow

re: character encodings re: HTML tips for 90s kids trying to make 20s websites, metadata edition 

@Packbat these instructions are for firefox but the process is similar for other browsers:

• open the Web Inspector (Tools > Browser Tools > Web Developer Tools)
• navigate to the Network tab
• reload the page
• click on the first request in the results (should be for the page you are on)
• in the panel that opens, look under “Response Headers” for “content-type”

if it says `text/html; charset=utf-8`, then no charset declaration is necessary

· · Web · 1 · 0 · 1

re: character encodings re: HTML tips for 90s kids trying to make 20s websites, metadata edition 

@Packbat (a lot of web servers just default to this now because almost everyone in 2023 is writing HTML pages as utf-8)

Sign in to participate in the conversation
📟🐱 GlitchCat

A small, community‐oriented Mastodon‐compatible Fediverse (GlitchSoc) instance managed as a joint venture between the cat and KIBI families.