用CSS更改内容? [英] Change content with CSS?
问题描述
我正在尝试通过样式表修改实际的html内容。我知道
有:before和:after标签,但我不太确定如何使用
它以及是否还有另一种方法可以做它。
这里是HTML代码:
< p class:xyz> Section Heading< / p>
这里有一些我在CSS中尝试的东西:
..xyz:在{content:< p>新标题<之后; p为H. }
..xyz:在{content:< p>新标题< p>之前}
两者都没有实际修改内容。有什么想法吗?
谢谢!
迈克
I''m trying to modify actual html content via the style sheet. I know
there is the :before and :after tags, but I''m not quite sure how to use
it and if there''s another way to do it.
Here''s the HTML code:
<p class:xyz>Section Heading</p>
Here''s some things I''ve tried in the CSS:
..xyz:after { content: <p>New heading<p> }
..xyz:before { content: <p>New heading<p> }
Neither actually modifies the content. Any ideas?
Thanks!
Mike
推荐答案
还有一件事......我在一个使用IE6作为他们标准的b / b
的组织中这样做,所以我知道:内容,:之前和:之后'工作。
我想知道是否有某种方法可以通过css嵌入javascript代码...或者是
这个问题同样存在吗?
谢谢!
Mike
One more thing.... I''m doing this in an organization that uses IE6 as
their standard, so I know that :content, :before and :after don''t work.
I wonder if there''s some way to embed javascript code via css... or is
that the very same issue?
Thanks!
Mike
2006年3月7日11:55: 40 -0800,
comp.infosystems。 www.authoring.stylesheets 迈克 < mp ***** @ gmail.com>
< 11 ********************** @ v46g2000cwv.googlegroups .COM>写道:
On 7 Mar 2006 11:55:40 -0800, in
comp.infosystems.www.authoring.stylesheets "Mike" <mp*****@gmail.com>
<11**********************@v46g2000cwv.googlegroups .com> wrote:
|我正在尝试通过样式表修改实际的html内容。我知道
|有:before和:after标签,但我不太确定如何使用
|如果还有另一种方法可以做到这一点。
|
|这是HTML代码:
|
| < p class:xyz> Section Heading< / p>
|
|这里有一些我在CSS中尝试过的东西:
|
| .xyz:在{content:< p>新标题< p>之后}
| .xyz:在{content:< p>新标题< p>之前}
|
|实际上都没有修改内容。任何想法?
| I''m trying to modify actual html content via the style sheet. I know
| there is the :before and :after tags, but I''m not quite sure how to use
| it and if there''s another way to do it.
|
| Here''s the HTML code:
|
| <p class:xyz>Section Heading</p>
|
| Here''s some things I''ve tried in the CSS:
|
| .xyz:after { content: <p>New heading<p> }
| .xyz:before { content: <p>New heading<p> }
|
| Neither actually modifies the content. Any ideas?
您需要将您的CSS修改为:
..xyz:在{content:" New heading" }
..xyz:在{content:" New heading"之前}
虽然它看起来不像你可以包含html标签,但你可以
能够设置顶级边距属性来实现相同的目标效果。
http://www.w3.org/TR/REC-CSS2/select...fore-and-after
http://www.w3.org/TR/REC-CSS2/generate.html
------------------------------------------------ ---------------
jn ****** @ yourpantsyahoo .com.au :脱掉裤子回复
---------------------------- -----------------------------------
You need to modify your css to:
..xyz:after { content: "New heading" }
..xyz:before { content: "New heading" }
Although it doesn''t look like that you can include html tags you might
be able to set the top-margin properties to achieve the same effect.
http://www.w3.org/TR/REC-CSS2/select...fore-and-after
http://www.w3.org/TR/REC-CSS2/generate.html
---------------------------------------------------------------
jn******@yourpantsyahoo.com.au : Remove your pants to reply
---------------------------------------------------------------
2006年3月7日11:55:40 -0800,迈克 <熔点***** @ gmail.com>写道:
On 7 Mar 2006 11:55:40 -0800, "Mike" <mp*****@gmail.com> wrote:
我正在尝试通过样式表修改实际的html内容。我知道
有:before和:after标签,但我不太清楚如何使用
它以及是否还有另一种方法可以做到这一点。
我必须说我发现这些:之前和之后:伪元素(不是标签)
非常可疑。 CSS没有修改HTML内容的业务。有*可能*是* b $ b b a少数可合理使用的情况。但是,如果IE曾经实现过它们,我很确定在99%的情况下它们会被不恰当地用于
。
这里是HTML代码:
< p class:xyz> Section Heading< / p>
这里有一些我试过的东西在CSS中:
.xyz:在{content:< p>新标题< p>之后}
.xyz:在{content:< p>新标题< p>之前}
实际上都没有修改内容。任何想法?
I''m trying to modify actual html content via the style sheet. I know
there is the :before and :after tags, but I''m not quite sure how to use
it and if there''s another way to do it.
I have to say I find these :before and :after pseudo-elements (not tags)
very dubious. CSS has no business modifying HTML content. There *may* be
a handful of cases where they can be used sensibly. But if IE ever
implements them I''m quite sure that in 99% of cases they will be used
inappropriately.
Here''s the HTML code:
<p class:xyz>Section Heading</p>
Here''s some things I''ve tried in the CSS:
.xyz:after { content: <p>New heading<p> }
.xyz:before { content: <p>New heading<p> }
Neither actually modifies the content. Any ideas?
二:
1)标题,使用< Hn>标记,而不是< P>
2)如果你想在不同的位置插入标准文本,服务器端
处理就是这样做的地方(PHP,JSP)或类似的)。
-
Stephen Poley
http://www.xs4all.nl/~sbpoley/webmatters/
这篇关于用CSS更改内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!