Displaying Hidden Elements
Here's a fun fact:
Did you know you can set display:block;
on things like <title/>
elements? Kind of cool, right? If you're super concerned about crazy small request sizes, you could probably save a couple bytes by displaying your <title>
instead of an <h1>
. Overkill, for sure -- but still sort of interesting.
But another, slightly cooler trick is adding a display:block; white-space: pre;
rule for select <script>
elements.
This is kind of awesome for times when you want to include a code sample in your page, but you also want that code to actually execute. Sure, you don't get syntax highlighting -- but you do get a couple extra nerd points. And you reduce the weight of your page a bit by not duplicating that code.
The More You Know™