【问题标题】:Drop Cap a first letter using html tag使用 html 标记首字母首字母大写
【发布时间】:2019-10-09 11:40:21
【问题描述】:

谁能帮我识别一个 HTML 标签,我可以用它来以“首字母大写”的形式写一个单词的第一个字母,就像我们在 MS word 中所做的那样?

【问题讨论】:

    标签: html css text formatting


    【解决方案1】:

    你可以试试这个。

    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>

    【讨论】:

    • 你已经使用Bootstrap完成了,如果我们只能使用html怎么办?
    • 答案中没有Bootstrap
    • 其实你已经使用了 class="second" 它的 Bootstrap
    【解决方案2】:

    以下 CSS 样式定义将导致所有 &lt;p&gt; 标记的第一个字母使用更大的字体和红色呈现:

    p::first-letter{
            color: red;
            font-size: 3.5em;
        }
    

    【讨论】:

      猜你喜欢
      • 2021-07-29
      • 2011-05-14
      • 1970-01-01
      • 1970-01-01
      • 2011-06-16
      • 2021-11-02
      • 2019-12-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多