最常用的CSS小把戏(Most used CSS tricks)

王朝html/css/js·作者佚名  2008-12-04
窄屏简体版  字體: |||超大  

版权声明:本文版权归原作者所有 译介仅供国内读者参考

本文概要:最常用的CSS Trick,诸如圆角、首字下沉等等。

之前有篇译介“8个一句话CSS小诀窍”介绍了8个非常使用的一句话CSS小技巧,这周再给大家带来一篇类似的文章,介绍了一些最常用的CSS Trick,或者叫做CSS小把戏。当然我相信每个设计师都会有一些个人的偏好,我个人对文中的一些小把戏就不太感冒。

1. 不使用图片的圆角效果

<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}

(很多人喜欢运用这样的圆角技巧,但我个人不是很喜欢,虽然不用去做圆角的图片,但是多出的这些tag总觉得很多余)

2. 样式化列表

<ol>

<li>

<p>This is line one</p>

</li>

<li>

<p>Here is line two</p>

</li>

<li>

<p>And last line</p>

</li>

</ol>

ol {

font: italic 1em Georgia, Times, serif;

color: #999999;

}

ol p {

font: normal .8em Arial, Helvetica, sans-serif;

color: #000000;

}

这个效果我也是很喜欢的,可以在序号上应用不同的字体。

3. 无表格表单

4. 双引号技巧

5. 渐变字效果

6. 垂直居中

更多内容参见原文

10. 首字下沉

<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>

p.introduction:first-letter {

font-size : 300%;

font-weight : bold;

float : left;

width : 1em;

}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航