Drop-caps using CSS

前端 未结 3 649
余生分开走
余生分开走 2020-12-21 09:32

How can I make the first character of each paragraph look like this:

\"enter

I

相关标签:
3条回答
  • 2020-12-21 09:52
    p:first-letter {
        float: left;
        font-size: 5em;
        line-height: 0.5em;
        padding-bottom: 0.05em;
        padding-top: 0.2em;
    }
    

    Tweak the font, padding, line-height as needed.

    Example: http://jsfiddle.net/RLdw2/

    0 讨论(0)
  • 2020-12-21 09:53

    add this p:first-letter{font-size:50px}

    DEMO


    Here is the exact solution for your requirement shown in the image

    DEMO 2

    WIKIPEDIA EXPLANATION

    0 讨论(0)
  • 2020-12-21 09:59

    see DEMO here...

    CSS///

    p{ width:300px; border:1px solid #000;}
    p:first-letter
    {font-size:52px;color:#8A2BE2;font-weight:bold;float: left;margin-top:4px;}
    

    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>
    
    0 讨论(0)
提交回复
热议问题