Changing the value of the first letter of each word

后端 未结 6 1089
我寻月下人不归
我寻月下人不归 2020-12-06 18:14

I\'m attempting to either use jQuery, CSS or PHP to increase the font size of the first letter of each word in a string. For example, I\'m going to have a title in h1 tags

6条回答
  •  太阳男子
    2020-12-06 18:16

    The easiest way is probably just straight CSS, though it creates a bit extra markup for you to write. JQuery would end up making the same amount of extra markup, though, with extra overhead, and would fail without JS support. h1.dropcaps div{ float:left; } h1.dropcaps div:first-letter { font-size : 300%; font-weight : bold; }

    Your
    text
    here

    UPDATE: It turns out :first-letter does not work inside an inline element in some browsers.

    The trick to fix this is to put them in divs, and float the divs. I have revised my markup. http://jsfiddle.net/MBZaw/

提交回复
热议问题