请教大师,这个css样式是意思是?

html-css012

请教大师,这个css样式是意思是?,第1张

这个就是指定页面默认字体样式,先检测第一个字体用户电脑上有没有,有的话就用这个,没有的话继续检测第二个,以此类推

如果都没有,那么就使用用户自己电脑的默认字体

这个你可以上CSS黑板报找很详细的相关说明

直接百度搜索:CSS黑板报,第一个就是了

控制背景图片的位置就可以了

用两个DIV,一个DIV套一个DIV ,然后加上分别都加上这个背景,调整宽度高度,控制图片位置就可以了……

下面是代码

你运行试试,注意图片地址:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=utf-8" />

<title>无标题文档</title>

</head>

<style>

.content{

background:url(sprites.jpg) no-repeat right -30px

width:200px

height:30px

}

.content div{

background:url(sprites.jpg) no-repeat left top

height:30px

width:190px

}

-->

</style>

<body>

<div class="content"><div></div></div>

</body>

</html>

我只写了一个字的变色其他也是一样的 利用随机数生成颜色编码 然后改写css

每次刷新 颜色都不一样

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/htmlcharset=gb2312" />

<title>会变色的字</title>

</head>

<body>

<p id="ppp"><b>会变色的字</b></p>

</body>

<script>

var chars = ['0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F']

function generateMixed(n) {

var res = ""

for(var i = 0i <n i ++) {

var id = Math.ceil(Math.random()*16)

res += chars[id]

}

return res

}

var num = generateMixed(6)

var p = document.getElementById('ppp')

p.style.color = "#"+num

</script>

</html>