CSS tab-size
The ridiculous tabs vs. spaces debate within code can get just as heated as the JavaScript semi-colon debate. I'm a tab guy myself but to each their own...just don't work on a project with me if you aren't. Anyways, I was quite surprised to find that you can set the tab space number of <pre> element code with CSS's tab-size
property!
The CSS
The tab-size
property takes an integer value representing the number of spaces a tab represents:
/* 4 spaces per tab */
pre {
tab-size: 4;
}
/* No indentation */
pre {
tab-size: 0;
}
As you can see, you could even remove indentation all together. Not recommended but possible.
I love this property as it's especially useful for code-heavy blogs, though it doesn't have much use outside of that.
![Create a Sheen Logo Effect with CSS]()
I was inspired when I first saw Addy Osmani's original ShineTime blog post. The hover sheen effect is simple but awesome. When I started my blog redesign, I really wanted to use a sheen effect with my logo. Using two HTML elements and...
![Regular Expressions for the Rest of Us]()
Sooner or later you'll run across a regular expression. With their cryptic syntax, confusing documentation and massive learning curve, most developers settle for copying and pasting them from StackOverflow and hoping they work. But what if you could decode regular expressions and harness their power? In...
![Chris Coyier: Some Amazing Work on CodePen III]()
I'm back! David asked me to rope up some of my favorite stuff on CodePen again, which I both love doing, and wince at the thought of having to pick so few favorites. I like a ton of stuff on...
![MooTools Equal Heights Plugin: Equalizer]()
Keeping equal heights between elements within the same container can be hugely important for the sake of a pretty page. Unfortunately sometimes keeping columns the same height can't be done with CSS -- you need a little help from your JavaScript friends. Well...now you're...
Didn’t know about that.
It’s so basic that I wouldn’t be surprised if that was defined in CSS1.
But it’s a recent thing it seems, and still vendor prefixed. No sign of support in IE, as Microsoft stubbornly thinks that tabs are as huge as 8 spaces!
For vendor prefixes and browser support comparison: https://developer.mozilla.org/en/docs/CSS/tab-size