三中的使用方法的简单实例如下:
行内样式:
<!doctypehtml><html><head><metacharset="UTF-8"><title>css行内样式</title></head><body><divstyle="width:100px;height:100px;background:red;"></div>></body></html>
内嵌样式:
!doctypehtml><html><head><metacharset="UTF-8"><title>css内嵌样式</title></head><body><styletype="text/css">#div{width:100px;height:100px;background:red;}</style><divid="div"></div>></body></html>
外部式:
<!doctypehtml><html><head><metacharset="UTF-8"><title>css内嵌样式</title><linkrel="stylesheet"type="text/css"href="ccss.css"></head><body><divid="div"></div>></body></html>
css文件
#div{width:100px;height:100px;background:red;}
简言之:
行内样式:就是代码写在具体网页中的一个元素内;比如:<div style="color:#f00"></div>内嵌式:就是在</head>前面写;比如:<style type="text/css">.div{color:#F00}</style>外部式:就是引用外部css文件;比如:<link href="css.css" type="text/css" rel="stylesheet" />