在HTML中引入CSS的方法几种方法
2014-05-13 21:03
369 查看
摘自:http://blog.163.com/dingchunkun_2006@126/blog/static/17149215120113223546835/
在HTML中引入CC有好几种方法,按优先级排列分别是:1、行内式,2、嵌入式,3、导入式和链接式
在HTML中引入CSS的方法有以下几种:
1)行内式
比如:
<body>
<h1 style="color:white;background-color:blue">
This is a line of Text.
</h1>
</body>
2)嵌入式
比如:
<head>
<style type="text/css">
h1{
color:white;
background-color:blue
}
</style>
</head>
<body>
<h1>This is a line of Text.</h1>
<h1>This is another line of Text.</h1>
</body>
3)导入式和链接式
先要把CSS的内容写到一个.CSS的文件中
比如:mycss.css
h1{
color:white;background-color:blue
}
导入式写法(注意CSS文件的路径要正确):
<head>
<style type="text/css">
@import"mycss.css";
</style>
</head>
<body>
<h1>This is a line of Text.</h1>
<h1>This is another line of Text.</h1>
</body>
链接式写法(注意CSS文件的路径要正确):
<head>
<link href="mycss.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1>This is a line of Text.</h1>
<h1>This is another line of Text.</h1>
</body>
在HTML中引入CC有好几种方法,按优先级排列分别是:1、行内式,2、嵌入式,3、导入式和链接式
在HTML中引入CSS的方法有以下几种:
1)行内式
比如:
<body>
<h1 style="color:white;background-color:blue">
This is a line of Text.
</h1>
</body>
2)嵌入式
比如:
<head>
<style type="text/css">
h1{
color:white;
background-color:blue
}
</style>
</head>
<body>
<h1>This is a line of Text.</h1>
<h1>This is another line of Text.</h1>
</body>
3)导入式和链接式
先要把CSS的内容写到一个.CSS的文件中
比如:mycss.css
h1{
color:white;background-color:blue
}
导入式写法(注意CSS文件的路径要正确):
<head>
<style type="text/css">
@import"mycss.css";
</style>
</head>
<body>
<h1>This is a line of Text.</h1>
<h1>This is another line of Text.</h1>
</body>
链接式写法(注意CSS文件的路径要正确):
<head>
<link href="mycss.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<h1>This is a line of Text.</h1>
<h1>This is another line of Text.</h1>
</body>
相关文章推荐
- 在html中引入css的几种方法
- HTML中引入CSS文件的几种方法
- HTML中引入CSS的方法
- html页面中引入css的几种方式
- html中引入css的四种方法
- HTML中引入CSS的四种方法(前端css面试题)
- html中引入css的四种方法
- HTML引入CSS的方法
- HTML中引入CSS的方法
- 黑马程序员_HTML中CSS使用的几种方法
- HTML中引入CSS的方法
- xcode,在webView中引入本地html,image,js,css文件的方法
- HTML页面引入CSS的几种方式及区别
- HTML中引入CSS的方法
- xcode,在webView中引入本地html,image,js,css文件的方法(ios自学笔记)
- html中引入CSS的方法
- 在HTML中引入CSS的方法
- 引入公共html页面的几种方法
- HTML中引用CSS的几种方法
- HTML中引入CSS的方法