【发布时间】:2019-10-09 11:40:21
【问题描述】:
谁能帮我识别一个 HTML 标签,我可以用它来以“首字母大写”的形式写一个单词的第一个字母,就像我们在 MS word 中所做的那样?
【问题讨论】:
标签: html css text formatting
谁能帮我识别一个 HTML 标签,我可以用它来以“首字母大写”的形式写一个单词的第一个字母,就像我们在 MS word 中所做的那样?
【问题讨论】:
标签: html css text formatting
你可以试试这个。
div.first {
line-height: 1.4em;
}
div.first:first-letter {
font-size: 2.8em;
float: left;
margin-top: 0.25em;
}
<div class="first"><span class="second">Ž</span>ed Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</div>
<div class="first"><span class="second">Z</span>as Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</div>
【讨论】:
以下 CSS 样式定义将导致所有 <p> 标记的第一个字母使用更大的字体和红色呈现:
p::first-letter{
color: red;
font-size: 3.5em;
}
【讨论】: