国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > CSS > 正文

CSS實現段落首字母、首字放大特效

2024-07-11 08:30:15
字體:
來源:轉載
供稿:網友
摘要:

  段落首字母放大是指放大段落開頭的字母或者漢字,主要使用了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>
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 忻州市| 玉门市| 定西市| 塔河县| 榆林市| 黔西县| 六安市| 清水县| 将乐县| 会同县| 成安县| 台中县| 策勒县| 思茅市| 昌宁县| 突泉县| 宕昌县| 临夏市| 霍邱县| 玛沁县| 五大连池市| 永胜县| 玛曲县| 永济市| 苍山县| 朝阳区| 达拉特旗| 龙州县| 阳东县| 永吉县| 新巴尔虎右旗| 延长县| 宁陵县| 双鸭山市| 怀来县| 石渠县| 仲巴县| 慈溪市| 清镇市| 通许县| 宁阳县|