HTML和CSS
四、HTML结构
<!DOCTYPE html>
<html>
<head>
<title标题</title>
</head>
<body>
正文部分
</body>
</html>
五、基本标签
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<!-- html基本标签 -->
<i>字体倾斜</i><br>
<b>字体加粗</b><br>
<u>字体有下划线</u><br>
<p>段落一</p><br>
<p>段落二</p><br>
<hr></hr><br><!-- 分割线 -->
<h1>最大标题标签</h1><br>
<h6>最小标题标签</h6><br>
<!-- 修改文字 -->
<font color="red">设置颜色为红色</font>
<!-- 容器标签 -->
<div style="background-color: yellow;">emmmmm....</div><!-- 占用的位置是一行 -->
<span style="background-color: blue;">....emmmmm</span><!-- 内容有多宽就占用多宽的空间距离 -->
</body>
</html>
六、超链接A标签
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<!-- href : 写的是一个链接地址 -->
<!-- 绝对路径并且在新窗口打开文档 -->
<a href="https://www.baidu.com/index.php?tn=monline_3_dg" target="_blank">百度一下</a><br>
<!-- 相对路径并且在本窗口打开文档
./ 本目录
../上一级目录
-->
<a href="./01_html结构.html" target=""_self"">东京喰种链接</a>
</body>
</html>
七、图片标签
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<!-- src 属性 : 资源路径(必须有) jpg,bmp,png,gif
alt 属性: 图片资源找不到的时候显示文字提示
width 属性:设置图片宽度
heigth 属性:设置图片高度(只写一个属性,等比缩放) -->
<img alt="" src="../image/djcz.jpg"><br>
<img alt="图片不存在" src="../image/ch.jpg"><br>
<img alt="" src="../image/timg.gif"><br>
<img alt="" src="../image/djcz.jpg" width="500px"><br><!-- 等比例缩放 -->
<img alt="" src="../image/djcz.jpg" width="500px" height="300px">
</body>
</html>
八、列表标签
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<!-- 无序列表 -->
<ul>
<li>银时</li>
<li>新八</li>
<li>神乐</li>
</ul><dr>
<!-- 无序嵌套列表 -->
<ul>
<li>芳村</li>
<li>利世</li>
<li>分类
<ul>
<li>羽赫</li>
<li>鳞赫</li>
</ul>
</li>
</ul><dr>
<!-- 有序列表 -->
<ol>
<li>银时</li>
<li>新八</li>
<li>神乐</li>
</ol><dr>
<!-- 定义列表 -->
<dl>
<dt>猪皮</dt>
<dd>曼基康短腿猫</dd>
<dt>中分</dt>
<dd>中华田园猫</dd>
</dl>
</body>
</html>
九、表格标签
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<!-- 表格默认是没有边框的,cellspacing将单元格合并 -->
<table border="1" width="700px" align="center" cellspacing="0px">
<caption>表格</caption><!-- 定义表格标题 -->
<tr style="height: 30px"><!-- 代表一行,设置行高 -->
<th>一</th><!-- 定义表格的表头,效果为加粗居中 -->
<th>二</th>
<th>三</th>
<th>四</th>
</tr>
<tr style="height: 30px">
<td></td><!-- 代表一列 -->
<td rowspan="2"></td><!-- 代表跨行 -->
<td></td>
</tr>
<tr style="height: 30px">
<td>最后 一行!</td><!-- 中文空格 -->
<td></td>
<td colspan="2"></td><!-- 代表跨列 -->
<td></td>
</tr>
<tr style="height: 30px">
<td>最后 一行!</td><!-- 英文空格 ,三个英文空格等于一个中文空格-->
<td></td>
<td></td>
</tr>
</table>
</body>
</html>
十、表单
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<form action="#" method="get">
<!-- 单行文本输入框 -->
用户名 : <input type="text"><br>
<!-- 密码输入框 -->
密码 : <input type="password"><br>
<!-- 单选框, name分组,name一样就是一组 -->
性别 :<input type="radio" name="gender">男<input type="radio" name="gender">女<br>
<!-- 复选框 -->
爱好 :<input type="checkbox">篮球<input type="checkbox">游泳<input type="checkbox">跑步<br>
<!-- 隐藏控件,中转数据 -->
<input type="hidden"><br>
<!-- 文件选择控件 -->
<input type="file"><br>
<!-- 图片提交按钮 -->
<input type="image" scr="../image/djcz.jpg"><br>
<!-- 下拉框 -->
省份 <select>
<option>四川省</option>
<option>江苏省</option>
<option>浙江省</option>
</select>
城市 <select>
<option>成都市</option>
<option>德阳市</option>
<option>绵阳市</option>
</select><br>
<!-- 单行文本输入框
Rows: 代表行(多少个字符)
Cols:代表列(多少个字符)
-->
简介 :<textarea rows="10" cols="50"></textarea>
<!-- 按钮主要是配合js页面脚本代码 -->
<!-- 普通按钮 -->
<input type = "button" value = "来按一下">
<!-- 重置按钮 -->
<input type = "reset" value = "重置表单">
<!-- 提交按钮 -->
<input type = "submit" value = "提交表单">
</form>
</body>
</html>
十一、CSS选择器
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
<!-- id选择器 -->
</style>
</head>
<body>
<div class="a">A</div>
<div id = "b">B</div>
<div>C</div>
<div>D</div>
</body>
</html>
十二、引用、继承与优先级
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="../css/css.css">
<style type="text/css">
#c{
color: yellow !important;
}
</style>
</head>
<body>
<!-- 就近原则
!important > 行内样式 > id选择器 > 类选择器 > 标签选择器 -->
<span style="color: red;">A</span>
<span>B</span>
<span style="color: red" id = "c">C</span>
<span>D</span>
</body>
</html>