No need to mention CSS is awesome. Its pure beauty of CSS that gives life to the website and makes it lively. Yes, it’s not simple to write CSS for newbie and even professionals sometimes gets stuck because of cross browser issues. Sometimes, One line in CSS can be more than a magic providing solutions. I reviewed some of the CSS files and came up with some one line CSS.
Below are list of one line CSS. One line CSS mentioned below may or may validate web standards and web accessibility rules.
1. Set default margin and padding to all elements
* {margin: 0; padding: 0}
Every element that have not assigned margin or padding will have default value of above.
Some CSS designers argue that this is not necessary at all because all CSS element at the end will have their assigned value.
2. Set image border to zero
img, a img { border: 0; }
This can be used to prevent any linked images from displaying borders.
3. Remove Firefox’s link border
a:active, a:focus { outline: 0; }
This removes dotted outline from focused or active links on firefox.
4. Scrolling Render IE
html { background : url(null) fixed no-repeat; }
5. Prevent line breaks in links, over sized content to break
a{ white-space:nowrap;} element { overflow:hidden; }
This trick prevents line breaks on links.
6. Centering block elements horizontally
element { margin:0 auto; }
This one line CSS horizontally centers a block level element.
For IE less than 7, following line should be added though.
element { text-align: center; }
7. Show Firefox scrollbar
html{ overflow:-moz-scrollbars-vertical; }
8. Remove textarea scrollbar in IE
textarea{ overflow:auto; }





Sashidhar Kokku
March 21, 2008
Good one. Thanks for the tips.
Miguel Benevides
March 22, 2008
while i disagree on some of the other tips, #3 is quite ‘regretable’ … it’s 2008 ;)
alen
March 22, 2008
hm, most of these tips look very familiar to me…
Alex
March 22, 2008
alen, yep few points matches
Felipe Giotto
March 25, 2008
Good tips! Solves many problems!
Thanks!
Ganesh
April 19, 2008
great tips. I have been using many of them for a while now, but #7 is news to me. Thanks.
sweetangel
June 10, 2008
css lessons – css scrollbar examples code
– http://css-lessons.ucoz.com/scroll-css-examples.htm –
cocomonkey
July 4, 2008
Great Tips! Great Tips! Wish i could find this site sooner – your tip to remove ff boarder on links works great! And i’ve added your boarder pics code too. A++ Cheers.