2021 week 35, CSS stacking and HTML parsing.

Plus letter casing.

Sep 5, 2021

A doodle of Cthulhu with the word stack in Chinese, Malay, and English on the left.

Stepping into September, 30% time left in 2021 and it’s been a little difficult to find a common theme from these items I’ve just revisited or learned weekly, please bear with me. Three items this week, first two are about CSS stacking context and parsing HTML with regex respectively while the last one will compare sentence case to title case.

  • CSS: stacking context is like an imaginary z-axis for HTML elements. z-index can be used to control the stacking order within the same parent stacking context and isolation: isolate; can be used to create new stacking context.

  • HTML: best not to parse HTML with regex else you might risk summoning Cthulhu. Jokes aside, it’s generally regarded as a bad practice although as most things, there might be suitable specific use cases. There are a couple of reasons behind this (e.g. HTML validity, nesting) but to put it simply, HTML is too complex for regex, use a library designed for that instead.

  • Letter casing: Sentence case is generally regarded as more friendly, allow proper nouns to stand out while title case is perceived as more serious and more prominent. Regardless of preference between the two, being consistent will help readability.

This is my 8th weekly post, thank you for reading and do let me know if you got any feedback.