翻译过一篇:提高css的可读性 http://xo-tobacoo.iteye.com/blog/190498
贴个例子,和我们管理管理java文档有异曲同工之妙:
html, body, div, p, ul, ol, li, form, fieldset, h1, h2, h3, h4, h5, h6, address { margin: 0; padding: 0; list-style: none; }
html { background: #000 url('../images/bg-html.gif') repeat-x; }
body { font: normal 62.8%/1.3 Tahoma, "Lucida Grande CE", lucida, sans-serif; color: #64030a; padding-bottom: 50px; background: url('../images/bg-body.jpg') 20% 0 no-repeat; }
a { color: #660306; }
a:hover { color: #c61116; text-decoration: underline !important; }
a img { border:0; }
input,
select,
textarea { font-family: lucida, sans-serif; font-size: 1em; vertical-align: middle; }
input.button,
select.button,
textarea.button { background: #fff; padding: 2px 0; border: none; color: #000 !important; }
button.button { margin: 0; padding: 0; height: 18px; border: none; text-decoration: underline; font-weight: bold; color: #00CCFF; cursor: pointer; }
input.submit { width: 87px !important; height: 22px; overflow: visible; padding: 0 5px; color: #fff; font-weight: bold; border: none; cursor: pointer; }
label { cursor: pointer; padding-right: 5px; line-height: 20px; }
h1 { font-size: 2em; margin-bottom: .5em; }
h2 { font-size: 1.7em; }
h3 { font-size: 1.5em; }
h4 { font-size: 1.3em; }
h5 { font-size: 1.2em; }
h6 { font-size: 1em; }
h1, h2, h3, h4, h5, h6 { color: #c61116; }
table { border-collapse: collapse; width: 100%; }
table th { text-align: left; }
table td.right { padding-left: 5px; }
table th.right { padding-left: 5px; }
table td.left { padding-right: 5px; }
table th.left { padding-right: 5px; }
blockquote { margin: 0; padding: 10px 20px; color: #333333; line-height: 1.6; font-family: Georgia, serif; }
fieldset { border: 0 !important; }
/* -- User friendly features --*/
.hidden { display: none; }
.noscreen { width: 200px; position: absolute; left: -9999px; top: -9999px; }
/* -- Basics layout -- */
#view { position: relative; }
#head { font-size: 1.2em; position: relative; z-index: 10; }
#content { font-size: 1.3em; position: relative; z-index: 1; }
#menu { font-size: 1.2em; }
#foot { font-size: 1.2em; position: relative; z-index: 1; }
/* -- Main classes -- */
.fr { float: right !important; }
.fl { float: left !important; }
.clear { clear: both !important; }
.right { text-align: right !important; }
.left { text-align: left !important; }
.center { text-align: center !important; }
.last { margin-right: 0 !important; margin-bottom: 0 !important; border-bottom: none !important; padding-bottom: 0 !important; background: none; }
.small { font-size: .90em; }
.big { font-size: 1.2em; }
.biggest { font-size: 2.3em; }
.light { color: #999999 !important; }
.alt { font-weight: bold; }
/* -- Main icons -- */
.ico { position: relative; padding-right: 30px; height: 20px; padding-bottom: 2px; vertical-align: middle; background: 100% 0 no-repeat; }
.ico-more { background-image: url('../images/ico/ico-more.gif'); }
/* -- Forms layout -- */
.formBox .lab { float: left; width: 19%; text-align: right; padding-right: 1%; }
.formBox .con { float: right; width: 80%; }
.formBox .button:focus { border-color: #000; }
/* -- Layout -- */
#view { width: 954px; margin: 0 auto; padding: 0 5px; background: url('../images/bg-shadow.png') 0 77px no-repeat; }
#head { height: 167px; }
#menu { position: absolute; top: 83px; left: 5px; z-index: 100; width: 954px; height: 84px; overflow: hidden; background: #181502 url('../images/bg-menu.gif') no-repeat; }
#content { padding: 25px 29px 40px 26px; margin-bottom: 3px; overflow: hidden; background-color: #fff; }
#foot { height: 51px; padding: 12px 25px 0; background: #2b0b00 url('../images/bg-footer.gif') repeat-x; clear: both; }
.subheader { margin-bottom: 24px; padding-left: 5px; font-weight: normal; font-family: Georgia, "New York CE", utopia, serif; }
#printPage { position: absolute; right: 25px; top: 25px; }
/* Header */
#logotype { float: left; display: block; padding: 18px 12px; font-size: 3em; font-weight: normal; font-family: Georgia, "New York CE", utopia, serif; }
#logotype,
#logotype * { color: #fefea2; text-decoration: none !important; }
/* Search Form */
#searchForm { position: absolute; top: 0; right: 0; width: 300px; text-align: right; padding: 28px 1px; font-size: 1.1em; }
#searchForm .button { width: 180px; height: 17px; padding: 5px 10px; margin-right: 5px; }
#searchForm .submit { width: 87px !important; height: 29px; background: #c40000 url('../images/bg-search-submit.gif') no-repeat; }
/* Menus */
#mainMenu { position: absolute; top: 42px; left: 0; height: 42px; padding: 0 28px; }
#mainMenu li { font-size: 1.5em; margin-right: 2px; float: left; }
#mainMenu li a,
#mainMenu li strong { display: block; width: 145px; height: 42px; float: left; padding-top: 10px; text-align: center; color: #fefea2; text-decoration: none !important; font-family: Georgia, "New York CE", utopia, serif; background: url('../images/bg-menu-item.gif') 0 0 no-repeat; }
#mainMenu li strong { color: #c61116; font-weight: normal; background: #fff url('../images/bg-menu-item.gif') 0 -42px no-repeat; }
#mainMenu li a:hover { text-decoration: underline !important; }
#subMenu { position: absolute; top: 0; right: 0; padding: 17px 26px; }
#subMenu li { display: inline; margin-left: 8px; }
#subMenu li a { color: #fffec5; }
/* Right sidebox */
#rightBlock { width: 274px; float: right; padding: 35px 0; }
#rightBlock .box { position: relative; margin-bottom: 30px; }
#rightBlock .submenu { margin-bottom: 50px; }
#rightBlock .submenu .in { background: url('../images/bg-submenu_top.gif') no-repeat; }
#rightBlock .submenu .in ul { padding: 1px 3px 1px 1px; font-size: 1.1em; background: url('../images/bg-submenu_bottom.gif') 0 100% no-repeat; }
#rightBlock .submenu .in ul li a,
#rightBlock .submenu .in ul li strong { display: block; height: 32px; padding: 12px 5px 0 30px; background: url('../images/bg-submenu-item.gif') 0 0 no-repeat; }
#rightBlock .submenu .in ul li strong { color: #9c3134; background: #fffed5 url('../images/bg-submenu-item.gif') 0 -44px no-repeat; }
#rightBlock .contact .in { padding: 30px 15px; height: 161px; background: #1f1b02 url('../images/bg-contact.gif') no-repeat; }
#rightBlock .contact .in * { color: #fffed5; }
#rightBlock .contact .in address { font-style: normal; margin-top: 20px; }
#rightBlock .contact .in .phone { color: #fff; }
#rightBlock .contact .in .more { position: absolute; bottom: 20px; right: 15px; }
#rightBlock .rss a { display: block; height: 40px; color: #fffed5; padding: 20px 0 0 64px; text-decoration: none; background: #b65c02 url('../images/bg-rss.gif') no-repeat; }
#rightBlock .rss a strong { text-decoration: underline; }
/* Left content part */
#contentBlock { width: 610px; float: left; padding: 25px 0; }
#contentBlock .subheader { margin-bottom: 20px !important; }
/* Article items */
#contentBlock .item { position: relative; width: 554px; padding: 20px 28px 0; margin-bottom: 10px; line-height: 1.4em; }
#contentBlock .first { background: url('../images/bg-item_first.jpg') no-repeat; }
#contentBlock .item .subheader { margin-bottom: 25px !important; padding: 0; }
#contentBlock .item .date { position: absolute; top: 16px; right: 16px; width: 80px; height: 23px; text-align: center; font-size: 1.4em; color: #fff; padding-top: 6px; background: url('../images/bg-item_date.png') no-repeat; }
#contentBlock .item .in { overflow: hidden; padding-bottom: 35px; background: url('../images/bg-item_separator.gif') 50% 100% no-repeat; }
#contentBlock .last .in { background: none !important; }
#contentBlock .item .in img,
#contentBlock .item .in a img { border: 3px #d4a65d solid; }
#contentBlock .item .in a:hover img { border-color: #a8803f; }
#contentBlock .item .in img { margin: 2px 6px 15px 0; }
#contentBlock .item .in img.left { float: left; margin: 2px 15px 10px 0; }
#contentBlock .item .in img.right { float: right; margin: 2px 0 10px 15px; }
#contentBlock .item .in ul,
#contentBlock .item .in ol,
#contentBlock .item .in p,
#contentBlock .item .in table { margin-bottom: 2em; }
#contentBlock .item .in ul { padding-left: 20px; }
#contentBlock .item .in ol { padding-left: 35px; }
#contentBlock .item .in ol li { list-style: decimal !important; }
#contentBlock .item .in ul li { margin: 3px 0; padding-left: 15px; background: url('../images/bg-inlink.gif') 0 .4em no-repeat; }
#contentBlock .item .in table td,
#contentBlock .item .in table th { padding: 5px 10px; border: 1px #660306 solid; }
#contentBlock .item .in table th { background-color: #660306; color: #fff; }
/* Footer */
#foot * { color: #fffec5; }
#foot .menu { padding-bottom: 20px; }
#foot .menu li { display: inline; margin-right: 16px; float: left; }
#foot p.copy { float: left; clear: left; width: 48%; }
#foot .support { position: absolute; top: 12px; right: 25px; width: 200px; text-align: right; }
#foot .support .hotmix { margin-top: 4px; float: right; }
#foot .support .hotmix a { position: relative; width: 55px; height: 13px; float: left; display: block; margin: 2px 0 0 5px; overflow: hidden; cursor: pointer; }
#foot .support .hotmix a span { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: url('../images/bg-hotmix.gif') 0 0 no-repeat; }
#foot .support .lt { position: relative; display: block; clear: both; float: right; right: -25px; top: 20px; }
#foot .support .lt a { position: relative; width: 14px; height: 14px; display: block; overflow: hidden; cursor: pointer; }
#foot .support .lt a span { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: url('../images/bg-lt.gif') 0 0 no-repeat; }
#foot a:hover { color: #fff !important; }