Home  >  Article  >  Web Front-end  >  CSS的函数取值attr()_html/css_WEB-ITnose

CSS的函数取值attr()_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 11:34:091113browse

attr()的定义和用法:
插入元素的属性值。 
在CSS2.1中attr()总是返回一个字符串。
在CSS3中attr()可以返回多种不同的类型。
浏览器支持:
IE浏览器支持此属性。
谷歌浏览器支持此属性。
火狐浏览器支持此属性。
特别说明:
1.IE7和IE7以下的浏览器不支持此属性。
2.CSS3的atrr()现在暂无浏览器支持。
实例代码:

<!DOCTYPE html><html><head><meta charset=" utf-8"><meta name="author" content="http://www.softwhy.com/" /><title>蚂蚁部落</title><style type="text/css">div:after{  content:attr(title);}</style></head><body><div title="通过attr()添加的内容">div原来的内容|</div></body></html>

原文地址是:http://www.softwhy.com/forum.php?mod=viewthread&tid=1153

更多css3知识可以参阅:http://www.softwhy.com/css3/

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn