H5/JS入门

w3school网站:

css常用属性

HTML5页面布局

css文件
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 的对象都是实例化了的,只可以使用而不能创建继承于这些对象的新的子类。

JavaScript 通过事件驱动执行

猜你喜欢

转载自blog.csdn.net/essity/article/details/74597090