4 回答

TA贡献1847条经验 获得超7个赞
有四种形式:
1.链入外部样式表,就是把样式表保存为一个样式表文件,然后在页面中用<link rel="stylesheet" type="text/css" href="*.css">链接这个样式表文件.
2.内部样式表,就是把样式表放到页面的<head>区里.
3.导入外部样式表,用@import,在<head>与</head><style type="text/css">
<!--
@import "*.css"
-->
</style>
4.内嵌样式,就是在标签内写入style="",比如:
<td style="border-left:#cccccc">设置表格左边框的颜色为灰色.

TA贡献1818条经验 获得超7个赞
一般来说只有3种:
1.最常用的,引入样式表,在样式表中编写样式,引入方式如下:
<link href="css/style.css" rel="stylesheet" type="text/css">
2.在Html头部用<style></style>包起来,在这里面编写样式:
<style type="text/css">
*{
padding: 0;margin: 0
}
</style>
3.在标签里面直接编写行内样式。
<div style="color: #333"><div>
当然还有一种方式是用JS直接更改或者赋值给某个标签,但是其实是属于第三种的范围的

TA贡献1911条经验 获得超7个赞
<html>
<head>
<title>test</title>
<link rel="stylesheet" type="text/css" href="样式文件路径" />
<style>
.. 样式表内容 ..
</style>
</head>
<body>
<p style="color:#f00;">text</p>
</body>
</html>
- 4 回答
- 0 关注
- 1127 浏览
添加回答
举报