5 ms·
What is the advantage of using CSS over SVG?
by neolog 6y ago
What is the advantage of using CSS over SVG?
- cphoover 6y agoIt's impressive someone was able to do this... I also do not see the advantage.
- o_m 6y agoFrom the looks of it you can put all the data in a table element without having to use javascript. If it was pure SVG you would have to mix the data and presentation, and it would make accessbility trickier.
- deleted 6y ago[deleted]
- johnx123-up 6y agoAccessibility. If CSS is disabled, it will render the data table.
- thitcanh 6y agoIf CSS is disabled SVG works just as well. I don’t know where you got the idea that SVG doesn’t work without CSS (or JS, for that matter)
- ydant 6y agoI think you misunderstood the point. The way this library works is the data is embedded in a table, which then gets converted to a chart by CSS - so if the CSS is disabled, the data is just presented as a table of numbers. I'm not sure if SVG can be written so that it gracefully falls back like that. You could generate SVG from the table using JavaScript, of course, and just hide the table with JavaScript.
- thitcanh 6y ago1. Seeing a website without CSS is not really something people are concerned about. 2. I want a graph, not a table. SVG is self-contained so WYSIWYG, always. 3. If you want to show both a graph and a table, with Charts.css your markup would contain the same table twice.
- thitcanh 6y agoThe advantage is that you write HTML/data and get a nice chart, whereas with SVG you need something to process the data, either in the browser with JS or locally with any graphing tool. Given the weight and quality, I’d advise against this solution. With 70KB you might as well just load JS and get interactive graphs that don’t have rendering artifacts (line graphs look awful on my phone)