本篇內容主要講解“CSS怎么實現段落首字母、首字放大特效”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“CSS怎么實現段落首字母、首字放大特效”吧!
專注于為中小企業(yè)提供網站建設、做網站服務,電腦端+手機端+微信端的三站合一,更高效的管理,為中小企業(yè)石龍免費做網站提供優(yōu)質的服務。我們立足成都,凝聚了一批互聯網行業(yè)人才,有力地推動了近1000家企業(yè)的穩(wěn)健成長,幫助中小企業(yè)通過網站建設實現規(guī)模擴充和轉變。
摘要:
段落首字母放大是指放大段落開頭的字母或者漢字,主要使用了css的first-letter偽類選擇器。
單行放大:
在第一行內放大,效果如下:
代碼如下:
<!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>這是一個測試</p>
</div>
</body>
</html>
注意:first-letter支持IE7+,first-line支持IE8+
多行放大:
效果如下:
代碼如下:
<!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>這是一個測試。這是一個測試。這是一個測試。這是一個測試。這是一個測試。這是一個測試。這是一個測試。</p>
</body>
</html>
到此,相信大家對“CSS怎么實現段落首字母、首字放大特效”有了更深的了解,不妨來實際操作一番吧!這里是創(chuàng)新互聯網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續(xù)學習!
網頁標題:CSS怎么實現段落首字母、首字放大特效
URL鏈接:http://aaarwkj.com/article0/igdeoo.html
成都網站建設公司_創(chuàng)新互聯,為您提供電子商務、網站建設、軟件開發(fā)、營銷型網站建設、品牌網站建設、網站收錄
聲明:本網站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網站立場,如需處理請聯系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯