how to have text of 2 font sizes in same line in HTML?

前端 未结 3 893
广开言路
广开言路 2021-01-12 02:33

I am developing a front end HTML page using bootstrap and basic HTML code. I need to print price of a particular product say $63. I want this to be in same line but the size

相关标签:
3条回答
  • 2021-01-12 02:50

    Only HTML: using

    1. Two span tags and 2. different font size in style
      <span style="font-size: 25px;">Rs</span> <span style="font-size: 50px;">2000/-</span>
    0 讨论(0)
  • 2021-01-12 02:58

    Check this http://jsfiddle.net/RPf4N/2/

    html

    <div id="mydiv">$<a>63</a></div>
    

    ur css

    #mydiv
    {
        font-size:20px;
    }
    #mydiv a
    {
        font-size:100px;
    }
    
    0 讨论(0)
  • 2021-01-12 03:07

     span { font-size: 3em;}
     span b { font-size: 60%; font-weight: normal }
    <span><b>$</b>63</span>


    You could also avoid to use a nested element to wrap the currency sign and use the ::first-letter pseudoclass to style it, but this requires a block or inline-block parent element, e.g.

    span { 
       font-size: 3em; 
       display: inline-block; }
    
    span::first-letter { font-size: 60%; }
    <span>$63</span>

    0 讨论(0)
提交回复
热议问题