问题描述
这个我有点累了。我想让我的#content div中的所有段落的第一个单词为14pt,而不是段落(12pt)的默认值。有没有办法在直接的CSS中做这个,或者我离开包装第一个单词在一个跨度来完成这个?
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 way to do this in straight CSS or am I left wrapping the first word in a span to accomplish this?
推荐答案
你正在寻找的是不存在的伪元素。有:第一个字母和:第一行,但没有:第一个字。
What you are looking for is a pseudo-element that doesn't exist. There is :first-letter and :first-line, but no :first-word.
你当然可以使用JavaScript。以下是我发现的一些代码:
You can of course do this with JavaScript. Here's some code I found that does this: http://www.dynamicsitesolutions.com/javascript/first-word-selector/
这篇关于CSS增加第一个字的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!