Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 使用CSS的首字母大写_Html_Css - Fatal编程技术网

Html 使用CSS的首字母大写

Html 使用CSS的首字母大写,html,css,Html,Css,如何使每个段落的第一个字符如下所示: 我更喜欢只使用CSS。添加这个p:first字母{font size:50px} 这是您的需求的精确解决方案,如图所示 CSS/// HTML/// <p>The first character of this paragraph will be 52px big as defined in the CSS rule above. Rest of the characters in this paragraph will remain

如何使每个段落的第一个字符如下所示:


我更喜欢只使用CSS。

添加这个
p:first字母{font size:50px}


这是您的需求的精确解决方案,如图所示



CSS///

HTML///

<p>The first character of this paragraph will be 52px 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>


<p>The first character of this paragraph will be 52px 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>
本段的第一个字符将是52px大
如上面CSS规则中所定义。其余的
本段中的字符将保持正常。这个例子
演示如何使用:要生效的第一个字母psedoo元素
任何HTML元素的第一个字符

这一段的第一个字符是52px大 如上面CSS规则中所定义。其余的 本段中的字符将保持正常。这个例子 演示如何使用:要生效的第一个字母psedoo元素 任何HTML元素的第一个字符

根据需要调整字体、填充、行高


示例:

也许?跨浏览器支持很重要?所有浏览器都支持吗?不,我不希望第一个字母变大,我希望它与图像中的显示方式完全一致。这不是OP要求的。很棒的解决方案。Wiki必须使用您的答案更新其页面;)
<p>The first character of this paragraph will be 52px 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>


<p>The first character of this paragraph will be 52px 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>
p:first-letter {
    float: left;
    font-size: 5em;
    line-height: 0.5em;
    padding-bottom: 0.05em;
    padding-top: 0.2em;
}