w3school网站:
CSS 教程:http://www.w3school.com.cn/css/index.asp
HTML 参考手册:http://www.w3school.com.cn/tags/index.asp
JavaScript:http://www.w3school.com.cn/b.asp
HTML 参考手册:http://www.w3school.com.cn/tags/index.asp
JavaScript:http://www.w3school.com.cn/b.asp
css常用属性
HTML5页面布局
css文件
id选择器示例:
class选择器示例:
1、外部样式表
id选择器示例:
#header {
background-color:black;
color:white;
text-align:center;
padding:5px;
}
#nav {
line-height:30px;
background-color:#eeeeee;
height:300px;
width:100px;
float:left;
padding:5px;
}
#section {
width:350px;
float:left;
padding:10px;
}
#footer {
background-color:black;
color:white;
clear:both;
text-align:center;
padding:5px;
}
注意:
id 属性只能在每个 HTML 文档中出现一次。
class选择器示例:
.center {
text-align: center
}
引用css的方法
1、外部样式表
<head>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
2、内部样式表
<head>
<style type="text/css">
#body {background-color: red}
#p {margin-left: 20px}
</style>
</head>
3、内联样式
<p style="color: red; margin-left: 20px">
This is a paragraph
</p>
JavaScript 被嵌入到 HTML 中
内部和外部
JavaScript 以对象为基础
JavaScript 的对象都是实例化了的,只可以使用而不能创建继承于这些对象的新的子类。