CSS to select/style first word

后端 未结 11 1826
礼貌的吻别
礼貌的吻别 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 13:52

    There isn't a plain CSS method for this. You might have to go with JavaScript + Regex to pop in a span.

    Ideally, there would be a pseudo-element for first-word, but you're out of luck as that doesn't appear to work. We do have :first-letter and :first-line.

    You might be able to use a combination of :after or :before to get at it without using a span.

提交回复
热议问题