css样式怎么来做闪光字?

html-css021

css样式怎么来做闪光字?,第1张

做闪光字可以用js代码来实现,纯css代码是很难实现的。JavaScript代码如下:

<div id="abc">这里是闪光的字</div>

<script>

var i=0

function shine(id){

var obj= document.getElementById(id)

if(i==0){obj.style.color="#000"i=1}else{obj.style.color="red"i=0}

}

setInterval("shine('abc')",100)

</script>

text-decoration: blink

这行代码本来就是闪字啊!

IE是解释CSS最差的浏览器,不闪很正常!

opera firefox 苹果浏览器都是闪字!如果你不想闪就text-decoration: blink这行删了

特殊字体一般不是说不能添加,而是考虑到用户电脑上预装的字体有限,所以局限在宋体和微软雅黑两种字体,css属性中有个font属性,例如{font-family:"迷你简菱心"},在装过这个字体的的电脑会有效果,但是再没有装过的电脑可能就是其它字体了,一般会解析为宋体,问题解决一般由两种解决方案。

第一:css3下载字体,代码如下

@font-face

{

font-family:

'自己命名字体名字'

src:

url('字体路径')

src:

url('FileName.eot?#iefix')

format('embedded-opentype'),

/*其它格式*/

url('FileName.woff')

format('woff'),

url('FileName.ttf')

format('truetype'),

url('FileName.svg#FontName')

format('svg')

font-style:

normal

font-weight:

normal

/*设置默认样式*/

}

.aa{font-family:"自己命名字体名字"}

不兼容ie8及以下浏览器

第二:切png图片