CSS to select/style first word

后端 未结 11 1842
礼貌的吻别
礼貌的吻别 2020-11-22 13:30

This one has me kind of stumped. I want to make the first word of all the paragraphs in my #content div at 14pt instead of the default for the paragraphs (12pt). Is there a

11条回答
  •  無奈伤痛
    2020-11-22 14:07

    Same thing, with jQuery:

    $('#links a').each(function(){
        var me = $(this);
        me.html( me.text().replace(/(^\w+)/,'$1') );
      });
    

    or

    $('#links a').each(function(){
        var me = $(this)
           , t = me.text().split(' ');
        me.html( ''+t.shift()+' '+t.join(' ') );
      });
    

    (Via 'Wizzud' on the jQuery Mailing List)

提交回复
热议问题