Hacker News new | past | comments | ask | show | jobs | submit login

8 is the standard tab width. That's probably why GitHub chose it. (Why 8? I've no idea. Somebody will be along with an explanation soon enough, I am sure, and you can decide whether you believe it or not. But, whatever, it has been 8 for a very long time.)



To change it from 8, you need the `tab-size` CSS property. This has long been supported by all except IE/Edge.

This can be very neat for responsive design: use tabs for your indentation, and then on large screens use `tab-size: 4` because you’ve got space to spare and four is generally superior to two, and on narrow screens use `tab-size: 2` because you don’t have as much width to play with.


I don’t think it’s GitHub that chose this; the standard size for a tab in most browsers seems to be eight characters.


That's a good point. I checked and it does actually just seem to pass the tab characters through, letting the browser do its thing.


If you're using a typewriter and constructing tables (hence "tab"), 8 is a good balance between column width and number of columns.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: