Css文字效果

來源:互聯網
上載者:User

標籤:

1.文字樣式:font-family

字型:sans-serif(字型醒目);serif(筆畫的開始和結束有額外的修飾部分,易讀性較強)

*頁面設計最好有多個備選字型

 

2.文字大小:font-size

分絕對大小和相對大小,採用相對大小px,%,em(%,em相對於父標記而言,沒有設定父標記則用瀏覽器預設值)。

不同瀏覽器採用相對字型大小。

 

3.字型顏色:color

span標記,可以針對某些具體字型來做改變,行內元素

 

4.文字粗細:font-weight

 

5.文字斜體:font-style

normal,italic,oblique

 

6.上底線,刪除線:text-decoration

blink閃爍,ie不支援,ff可以

 

7.英文字母大小寫:text-transform

capitalize首字母大寫;uppercase大寫;lowercase小寫

 

8.段落對齊

水平:text-align;垂直:vertical-align,對於文字本身而言,該屬性對於區塊層級元素不起作用,對於表格有用。

 

9.行間距:line-height 字間距:letter-spacing

 

10.首字放大:float和span,通過span標籤對首字進行特殊的樣式控制,然後float:left反白

偽類:first-letter,也可以實作類別似首字放大,但該屬性的文字對一些其他的CSS樣式支援的不好,不推薦使用。

 

例子:百度搜尋內容顯示

 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 5 <title>百度搜尋網頁面</title> 6 <style type="text/css"> 7 body{ 8     margin:0px; 9     padding:0px;}10 p{11     margin:0px;12     font-family:Arial, Helvetica, sans-serif;}13 p.title{14     padding-bottom:0px;15     font-size:16px;}16 p.content{17     padding-top:3px;18     font-size:13px;19     line-height:18px;}20 p.link{21     font-size:13px;22     padding-bottom:25px;23     color:#008000;}24 span.search{25     color:#c60a00;}26 span.quick{27     color:#666666;28     text-decoration:underline;}29 p.title span.search{30     text-decoration:underline;}31 32 </style>33 </head>34 35 <body>36  <p class="title"><a href="#">中國<span class="search">春節</span>網歡迎您</a></p>37  <p class="content">在中國傳統的節日中,最熱鬧。最受人們重視的節日是<span class="search">春節</span>。<span class="search">春節</span>,是農曆的元旦,是... 送壓歲錢是潮汕春節習俗中重要的一項,長輩要分錢給後輩,能掙錢的後輩也要送...</p>38  <p class="link">www.chunjie.net.cn 2012-11-08  - <span class="quick">百度快照</span></p>39 </body>40 </html>

 

Css文字效果

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.