4 ms·
1. CSS and HTML are extremely resilient, they ignore your typos and unsupported features gracefully and never crash, so just daring to use them in your code, no
by ausjke 9y ago
1. CSS and HTML are extremely resilient, they ignore your typos and unsupported features gracefully and never crash, so just daring to use them in your code, no need for exception handling comparing to JS, in that sense, if you can do it in CSS, avoid JS.
2. Leverage CSS override
3. Use browser devtools to test all browsers. No need install all older browser to check CSS. icanuse helps greatly too.
4. Use feature-queries for CSS.
These indeed can make your CSS code work for both the stone age and hottest browsers, all at the same time, without much hacking. Great videos.
- dvddgld 9y agoGreat link and thanks for the tldr!
- taeric 9y agoThe first point sorta sets you up for disaster, though. If you do it in css and it works in the browser you are testing, but not in an older one you support. Heaven help you if the person fixing the older browser doesn't take into account the interaction between the working css and the js they use to get it working in the older browser.
- deleted 9y ago[deleted]
- afarrell 9y ago> they ignore your typos and unsupported features gracefully I wish there was a browser version that would handle these errors loudly rather than silently. The fact that React does some of this is rather nice.
- pjmlp 9y agoThat was one of the goals of XHTML....
- yoz-y 9y agoI find it quite baffling that we have gone to such lengths to make html/css resilient. I know of no other language/format that does this. Can you, for example, make a half broken PDF and would it still render?
- apatters 9y agoThe ones doing the implementing are the browser vendors and it's a competitive disadvantage for them to not render every site on the web as best as they can. Consumers who come across a broken site will blame the browser and switch to a different one.
- yoz-y 9y agoHaven't thought of that. It does make sense, the incentives are all wrong thinking about it. Publishers want the sites to be made quickly, browser vendors need market share and users have no patience and very low bar for acceptance.
- thristian 9y agoAt a previous job, a colleague was working on PDF parsing and rendering; he told me that Acrobat Reader will successfully load and display terrifyingly broken PDFs, and it's far more resilient than any of the open-source PDF-rendering tools. So yeah, I bet you can.
- my_ghola 9y agoPhp gets away with making many things warnings instead of errors. So it seems to have been made with the same mentality as html and css.
- paulddraper 9y agoYes. Adobe in particular will accept a ton of crap
- blattimwind 9y agoBrowsers log CSS and JS errors. There was an Old-Firefox extension giving you error counts in the menu bar.