在 CSS 中,哪個元素用於為選擇器文字的第一個字母新增特殊樣式
使用 :first-letter 元素為文件中元素的第一個字母新增特殊效果。您可以嘗試執行以下程式碼,為文字第一個字母新增特殊樣式 -
示例
<html>
<head>
<style>
p:first-letter {
font-size: 5em;
}
p.normal:first-letter {
font-size: 10px;
}
</style>
</head>
<body>
<p class="normal"> First character of this paragraph will be normal and will have font size 10 px;</p>
<p>The first character of this paragraph will be 5em big as defined in the CSS rule above. Rest of the characters in this paragraph will remain normal. This example shows how to use :first-letter pseduo element to give effect to the first characters of any HTML element.</p>
</body>
</html>
廣告
資料結構
計算機網路
關係型資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 語言
C++
C#
MongoDB
MySQL
Javascript
PHP