GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing cssbattle.dev — Tips & Tricks | CSSBattle 0 Online Sign In / Sign Up LoginInfoHere, we list some tips and tricks for CSS code-golfing that can help you get better scores. These tips are curated from numerous sources, many of which are generously shared by some of our awesome CSSBattle-ers: Alex Zaworski, Ilya Streltsyn, Praveen, Stas Lashmanov, Jon Uleis and many more 🙏! DISCLAIMER: The strategies listed here are not meant to be used in real projects. They mostly help you in CSSBattle code-golfing (expect for few which can be used elsewhere). In real world you'll probably use a minifier to make your files smaller. Want to add a tip you discovered? Mail us. Tips & TricksWhite-space removalThe most basic strategy for code-golfing — remove unnecessary spaces, tabs, newlines, etc. These characters are not necessary for the code to work functionally. This is one of the things that minifiers do to your code too. Loading... Loading... Omit the last semi-colonSemi-colon for the last CSS declaration in a declaration block can be omitted. Loading... Loading... Omit the closing tagsIn most cases, you can omit the closing tag of an element. This works because the Browser closes them for you, to make the HTML valid. Though, be cautious as in some cases seemingly unclosed sibling tags can become parent-child of each other. Loading... Loading... Remove Double QuotesYou can remove the quotes from HTML attributes and replace the white-spaces before numbers with a Loading... Loading... Shorten selectors with made-up attributesYou can assign made-up attribute to any element to target it specifically in your selectors. Here is an example where you want to select the 3rd Loading... Loading... position:fixed beats position:absolute, mostlyIn most cases, you might want to absolutely position an element with respect to the window/viewport instead of another element. In such Loading... Loading... Play with the unitsExperimenting with different units can save you a character or two, and give you that extra edge. For eg. Loading... Loading... You don't always need to add an HTML element to style!By default, you have the Loading... Loading... Omit the 'px' unitFor many properties, you can omit the Loading... Loading... <body> has some ancient super-attributes!There are old deprecated attributes available on Loading... Loading... We'll keep adding more mind-blowing tips here. Check back for more! ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |