开发者

Can CSS access the content of an element as it can the attributes? [duplicate]

开发者 https://www.devze.com 2023-04-04 06:45 出处:网络
This question already has answers here:开发者_运维百科 Closed 11 years ago. Possible Duplicate: 'content' attribute to inherit node value
This question already has answers here: 开发者_运维百科 Closed 11 years ago.

Possible Duplicate:

'content' attribute to inherit node value

I know you can access the content of an element's attribute like this:

a[href]:after { content: " (" attr(href) ")"; }

Is there a way to access the actual textual content of the element? What I need to do is make an <h2> on the page appear as if it's duplicated (for styling purposes) without actually having it duplicated in the markup.

I can't pull this off with a simple text-shadow because I need this duplicated version to appear behind an image while the original appears above.


The following may help

E::first-line   the first formatted line of an E element
E::before           generated content before an E element
E::after            generated content after an E element

However I beleive what you want to do can be done by z-index and position:relative or position:absolute. Use js to duplicate the h2 tag and add a class to position it behind the image.

0

精彩评论

暂无评论...
验证码 换一张
取 消