CSS怎么實(shí)現(xiàn)段落首字母、首字放大特效

本篇內(nèi)容主要講解“CSS怎么實(shí)現(xiàn)段落首字母、首字放大特效”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“CSS怎么實(shí)現(xiàn)段落首字母、首字放大特效”吧!

專注于為中小企業(yè)提供網(wǎng)站建設(shè)、做網(wǎng)站服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)石龍免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了近1000家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。

摘要:

段落首字母放大是指放大段落開頭的字母或者漢字,主要使用了css的first-letter偽類選擇器。

單行放大:

在第一行內(nèi)放大,效果如下:

CSS怎么實(shí)現(xiàn)段落首字母、首字放大特效

代碼如下:


<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <title>Document</title>
   <style>
       body {
           background-color: #FFFFFF;
           color: #595959;
       }
       .contain {
           width: 150px;
       }
       .contain p {
           font: 80%/1.6 Verdana, Geneva, Arial, Helvetica, sans-serif;
       }
       .contain p:first-letter {
           font-size: 2em;
           padding: 0.1em;
           color: #000000;
           vertical-align: middle;
       }
       .contain p:first-line {
           color: red;
       }
       .contain p:first-child:first-letter {
           color: red;
       }
       .contain p:first-child:first-line {
           color: inherit;
       }
   </style>
</head>
<body>
   <div class="contain">
       <p>This is a test article. This is a test article.</p>
       <p>This is a test article. This is a test article.</p>
       <p>這是一個(gè)測(cè)試</p>
   </div>
</body>
</html>

注意:first-letter支持IE7+,first-line支持IE8+

多行放大:

效果如下:

CSS怎么實(shí)現(xiàn)段落首字母、首字放大特效

代碼如下:


<!DOCTYPE html>
<html lang="en">
<head>
   <meta charset="UTF-8">
   <title>Document</title></p> <p></head>
<body>
   <style>
   * {
       margin:0;
       padding:0;
   }
   body {
       font-size:12px;
       font-family: Tahoma, Geneva, sans-serif;
       padding:200px;
   }
   p {
       width:150px;
       color:#000;
       font-size:1em;
       margin-bottom: 20px;
   }
   p:first-letter{
       float: left;
       font-size:2.5em;
       padding-right:5px;
       text-transform:uppercase;
   }
   p:first-line{
       color:#f00;
   }
   </style>
   <p>This is a test article. This is a test article.This is a test article. This is a test article.This is a test article. This is a test article.</p>
   <p>這是一個(gè)測(cè)試。這是一個(gè)測(cè)試。這是一個(gè)測(cè)試。這是一個(gè)測(cè)試。這是一個(gè)測(cè)試。這是一個(gè)測(cè)試。這是一個(gè)測(cè)試。</p>
</body>
</html>

到此,相信大家對(duì)“CSS怎么實(shí)現(xiàn)段落首字母、首字放大特效”有了更深的了解,不妨來實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

網(wǎng)頁標(biāo)題:CSS怎么實(shí)現(xiàn)段落首字母、首字放大特效
URL鏈接:http://bm7419.com/article0/igdeoo.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供電子商務(wù)、網(wǎng)站建設(shè)軟件開發(fā)、營銷型網(wǎng)站建設(shè)品牌網(wǎng)站建設(shè)、網(wǎng)站收錄

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站優(yōu)化排名