=============================================================================== notryan.com/blog/013.txt Fri, 08 May 2020 Ryan Jacobs 14:54:20 -0700 Minimalist HTML . . . . . . . . =============================================================================== This article is about HTML5. Note: Some of these *might* break spec, but are so commonplace that they might as well be in here. For example,
, add some content, and then end the document without providing the closing
tag. The browser will construct a DOM with a element. Closing tags will be generated for you, in a nested fashion. This lets you to do things like this: (Although, meta redirects aren't even spec compliant with W3C... but alas, that's a can of worms for another day...) * Quotes are optional for tag attributes. For example, (Of course, there must be no spaces, etc.) * Both single-quotes and double-quotes are valid for tag attributes. This is useful for producing valid HTML output in programs without resorting to escaped double-quote. For example, in the C language: printf(") of links is a handy way to introduce automatic line breaks. For example, this will render nicely:* link 1 * link 2 * link 3Though, keep your links short and be mindful that your text will not wrap. I like using this technique to generate stupid simple index.html files in BASH: #!/bin/bash gen() { echo "" for f in *; do echo "* $f" done echo "" } gen | tee index.html This works with filenames containing spaces... but not single quotes. Modify it for your use cases. * Add this tag to support mobile views: This snippet is copy and pasted a whole lot around the web. Most people don't explain how it actually functions though. "width" sets the initial width to the mobile's physical display width in 100% pixels. This is instead of a virtual viewport. This will ensure that the max-width property works properly. Tags such ashave an implicit `max-width: auto`. Now their content will flow properly and wrap to the display's dimensions. "initial-scale" sets the initial zoom to a more sensible value, so that high DPI screens (i.e. smart phones) will fill the screen properly. * You can skip out on "http:" or "https:" when defining your references by using the shorthand notation "//" which means "use the current protocol". For example: here is a link ------------------------------------------------------------------------------- Thanks for reading. Last of all, if you are currently reading on a mobile device, this website was served to you via server.c, which you can find at the root of this site. I detected your User-Agent as mobile and served you an HTML version of this text document to prevent text wrapping. The HTML document was produced as "Minimal HTML" by mobile.c, which you can also find at the root of this site. I apologize if 80-column text is hard to read on your phone. But I don't want to deal with two different versions of my site. I like plaintext. I like formatting it exactly how I want. You're seeing it like you would have on the desktop. UPDATES: #1 - 5:45 PM, 5/8/20 - Description on mobile viewports and a why bit. #2 - 7:40 PM, 5/8/20 - Blurb about corrections and a follow-up. #3 - 2:00 PM, 5/9/20 - Include tips from Reddit at the top. Add "//" tip.