Earlier before I have written an article about current best CSS hacks which you can see here And now here’s the list of today’s most used CSS tricks – tips. I have added image examples for most of them because of critics on CSS hacks article. If you think I have missed any please let me know
1. Rounded corners without images
<div id="container"> <b class="rtop"> <b class="r1"></b> <b class="r2"></b> <b class="r3"></b> <b class="r4"></b> </b> <!--content goes here --> <b class="rbottom"> <b class="r4"></b> <b class="r3"></b> <b class="r2"></b> <b class="r1"></b> </b> </div> .rtop, .rbottom{display:block} .rtop *, .rbottom *{display: block; height: 1px; overflow: hidden} .r1{margin: 0 5px} .r2{margin: 0 3px} .r3{margin: 0 2px} .r4{margin: 0 1px; height: 2px}

2. Style your order list
<ol> <li> This is line one </li> <li> Here is line two </li> <li> And last line </li> </ol> ol { font: italic 1em Georgia, Times, serif; color: #999999; } ol p { font: normal .8em Arial, Helvetica, sans-serif; color: #000000; }

3. Tableless forms
<form> <label for="name">Name</label> <input id="name" name="name"><br> <label for="address">Address</label> <input id="address" name="address"><br> <label for="city">City</label> <input id="city" name="city"><br> </form> label,input { display: block; width: 150px; float: left; margin-bottom: 10px; } label { text-align: right; width: 75px; padding-right: 20px; } br { clear: left; }

4. Double blockquote
blockquote:first-letter { background: url(images/open-quote.gif) no-repeat left top; padding-left: 18px; font: italic 1.4em Georgia, "Times New Roman", Times, serif; }

5. Gradient text effect
<h1><span></span>CSS Gradient Text</h1> h1 { font: bold 330%/100% "Lucida Grande"; position: relative; color: #464646; } h1 span { background: url(gradient.png) repeat-x; position: absolute; display: block; width: 100%; height: 31px; } <!--[if lt IE 7]> <style> h1 span { background: none; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='gradient.png', sizingMethod='scale'); } </style> <![endif]-->

6. Vertical centering with line-height
div{ height:100px; } div *{ margin:0; } div p{ line-height:100px; } Content here

7. Rounded corners with images
<div class="roundcont"> <div class="roundtop"> <img src="tl.gif" alt="" width="15" height="15" class="corner" style="display: none" /> </div> CONTENT <div class="roundbottom"> <img src="bl.gif" alt="" width="15" height="15" class="corner" style="display: none" /> </div> </div> .roundcont { width: 250px; background-color: #f90; color: #fff; } .roundcont p { margin: 0 10px; } .roundtop { background: url(tr.gif) no-repeat top right; } .roundbottom { background: url(br.gif) no-repeat top right; } img.corner { width: 15px; height: 15px; border: none; display: block !important; }

8. Multiple class name
<img src="image.gif" class="class1 class2" alt="" /> .class1 { border:2px solid #666; } .class2 { padding:2px; background:#ff0; }
9. Center horizontally
<div id="container"></div> #container { margin:0px auto; }

10. CSS Drop Caps
<p class="introduction"> This paragraph has the class "introduction". If your browser supports the pseudo-class "first-letter", the first letter will be a drop-cap. p.introduction:first-letter { font-size : 300%; font-weight : bold; float : left; width : 1em; }

11. Prevent line breaks in links, oversized content to brake
a{ white-space:nowrap; } #main{ overflow:hidden; }
12. Show firefox scrollbar, remove textarea scrollbar in IE
html{ overflow:-moz-scrollbars-vertical; } textarea{ overflow:auto; }
Have some feedback? Leave a comment



Pingback: IT民工的坐井观天 » 最常用的CSS小把戏(Most used CSS tricks)
Pingback: Os doze mais utilizados truques de CSS | Tecnologia da Informação - Desenvolvimento e Educação
Pingback: links for 2008-04-08 | Eugeni’s blog
Pingback: Most used CSS tricks | StylizedWeb.com : Tenglar, án ábyrgðar
Pingback: CSS Kniffe auf Apfelknacker
Pingback: HD Blog » Most used CSS tricks
Pingback: links for 2008-04-23 « Yet another blog
Pingback: Trucos CSS mas utilizados
Pingback: CSS Tricks Anyone?
Pingback: cwpfolio.com » Blog Archive » Ten Links For The Week
Pingback: Los 12 trucos de CSS más usados… y necesarios
Pingback: CSS Tricks und Tutorials | Photoclinique
Pingback: Интересное в сети.. « Блог Серёжи Борзова
Pingback: DICAS MAIS ÚTEIS DE CSS « GR!LO PRESS
Pingback: 12 часто используемых CSS приемов | Listeria.ru
Pingback: Thursday Links Roundup #5 - Putting Blogs First
Pingback: 25 Awesome tutorials for web designers « Narendra Dhami
Pingback: 25 Awesome tutorials for web designers « Guiwells’s Blog
Pingback: From free for free » Blog Archive » 25 Awesome tutorials for web designers
Pingback: Web geliştiriciler için 25 harika paket
Pingback: 25 Awesome tutorials for web designers | Boxed CSS
Pingback: 25 Awesome tutorials for web designers | Boxed CSS
Pingback: 9 Top CSS Essential Skills That Every Web designer Should Learn - aComment.net
Pingback: links for 2008-08-21 | Funny Web Pages
Pingback: 9 Top CSS Essential Skills That Every Web designer Should Learn « Kurt’s Rasmussen Class Weblog
Pingback: 25 Awesome tutorials for web designers | 打篮球的手
Pingback: RSSA聚合 » 25 Awesome tutorials for web designers
Pingback: CSS Tricks - digital-workshop
Pingback: En Cok Aranan Css Uygulamaları | C.AKIN Web Page
Pingback: Emo Nedir? Nasıl Emo Olunur? EmoTurka | En Cok Aranan Css Uygulamaları
Pingback: ART178: Intro. to Web Design » Blog Archive » CSS Positioning
Pingback: Most used CSS tricks | StylizedWeb.com | Personal
Pingback: Bookmarks for Dezember 10th through Dezember 11th | maximi maxima maxi max ist da
Pingback: en çok kullanılan basit css teknikleri « zrmbilisim katkıları ile 2009 seo yarışması
Pingback: Blog - FRHost Hospedagem de Site » Blog Archive » 9 Dicas de CSS que todo Designer deve Saber
Pingback: Most Used CSS Tricks | From the desk (and BlackBerry) of Keith Parnell
Pingback: Neonblood
Pingback: her web tasarımcının öğrenmesi gereken 9 önemli css yeteneği |
Pingback: » Blog Archive » Los trucos CSS mas utilizados
Pingback: 我想网 » Blog Archive » 最有用的CSS技巧
Pingback: 350+ CSS Tools and 160+ RSS Feeds for Web Developers and Web Designers « WebDevTeam’s Blog
Pingback: 84 Amazingly Useful CSS Tips & Resources | Hi, I'm Grace Smith
Pingback: 84个CSS教程,老外的。 - Booto’Blog
Pingback: 84 Useful CSS Tips & Resources | Monty Tuts - Your Ultimate Web Design Resource
Pingback: 84 Amazingly Useful CSS Tips & Resources | Grace Smith | cssOrigins.com
Pingback: 50+CSS实用技巧和资源汇总 | 博译论 | 分享网络热门与新知 关注网络应用与营销
Pingback: Digest 04/09: CSS, HTML e Layout | Boas práticas de Desenvolvimento com Padrões Web
Pingback: 200+ anv
Pingback: 84 recursos y consejos sobre CSS « GoVisual
Pingback: Css Styles Links « bnotezz