直接使用 英文感叹号(!)+tab键 生成下面的结构:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
</body>
</html>
网站叫什么名字,都是在<title></title>
内输入网站标题实现。
网页看到的内容都是在<body></body>
标签内编写代码实现。
form+tab键
实现生成表单
它的参数:
action =>地址,用于传参给它
method => 提交方式 GET (通过网址传参,参数会在网址上显示) 示例:https://www.baidu.com/s?ie=utf-8&f=8
POST (浏览器内部传) 它更安全,它传得更多
input + tab键 生成一个文本表单
<input type="文本框的类型,改的值是这里" />
type的值可以取的有:
text 文本
password 密码
number 数字
date 日期
email 邮箱
radio 单选
checkbox 多选
reset 按钮重置
下拉框:
select
里面的选项用的是 option
多行文本:
textarea
<!-- 第二种:内嵌式 :只能被当前网页使用,不能被别的网页引用,它不能共用 -->
<!-- style + tab生成 -->
<style>
/* 标签名{ 属性名:属性值 } */
h1{
color:aqua;
font-size: 90px;
}
</style>
<!-- 第三种:导入式 => 工作中用它比较多 -->
<!-- 导入式的代码可以共用,所以工作都是用它最多 -->
<link rel="stylesheet" href="./style.css">
<!-- 1、CSS的用法 行内式 -->
<!-- style => 样式,风格 -->
<h1 style="color: rgb(182, 94, 94);text-align: center;">这是一个标题</h1>
<!--
如果用行内式,每个标签都要重复写一样的CSS代码才能修饰,这样代码很冗余,所以不推荐使用行内式
-->
/* 1、id选择器
#id名{
属性:值;
}
*/
#box{
background-color: olivedrab;
width:200px;
}
/* 2、类名选择器
.类名{
}
*/
.title{
/* 文字居中 */
text-align: center;
color:red;
}
/* 3、标签选择器
标签名{
}
它会选择全部名称一样的标签都会修改!!
*/
#box li{
height:40px;
}
/* 组合选择器 */
h1,
.intro,
#division{
color:red;
}
/* 包含关系 */
#box ul li{
height:40px;
color:tomato;
}
#box ul li a{
color:turquoise;
}
/*
如果说想限制标签和名称的组合,才有样式,可以用交集选择器
*/
li#list{
background:violet;
}
li.title{
font-size:60px;
}
/* 伪类选择器 */
a:hover{
color:red;
font-size:60px;
}
#divs{
width:200px;
height:200px;
background:violet;
}
#divs:hover{
width:400px;
height:400px;
background:red;
}
也就是父级标签拥有的样式,子标签也会拥有,并且生效。
标签拥有优先级。
<h1 style="background: aqua;" id="title" class="in">这是一个h1标签</h1>
<style>
/* 行内样式 > ID类名选择器 > 类名选择器的优先级 > 标签选择器 */
h1{
background:#ccc;
}
.in{
background:yellow;
}
#title{
background:red;
}
</style>
h1{
/* 设置字体 */
font-family: "宋体";
/* 设置字体大小 */
font-size: 40px;
/* 设置颜色 */
color:brown;
/* 加粗 */
font-weight: bolder;
/* 演示行高设置 =》 主要用于文字垂直居中 */
height:100px;
/* 垂直居中的关键:标签的高度是多少,行高就给多少!!! */
line-height: 100px;
background-color: burlywood;
/* 水平对齐 */
text-align: center;
/* 文字间距 */
letter-spacing: 50px;
/* 下划线 */
text-decoration: underline;
}
/* 向上走10像素 */
/* 1、单独写外边距 */
margin-top: 10px;
margin-left: 10px;
margin-right: 20px;
margin-bottom: 40px;
/* 2、同时设置四个方向 */
/* 顺时针写 上右下左 */
margin:40px 50px 60px 70px;
/* 3、同时设置上下 左右 */
margin:20px 60px;
/* 4、三个值的情况 : 上 左右 下 */
margin: 10px 20px 30px;
/* 盒子居中方法 最经常用!! */
margin:0 auto;
/* =============== 内边距的使用方法 ============= */
/* 1、单独写内边距 */
padding-top: 10px;
padding-left: 10px;
padding-right: 20px;
padding-bottom: 40px;
/* 2、同时设置四个方向 */
/* 顺时针写 上右下左 */
padding:40px 50px 60px 70px;
/* 3、同时设置上下 左右 */
padding:20px 60px;
/* 4、三个值的情况 : 上 左右 下 */
padding: 10px 20px 30px;
#box{
width:100px;
height:100px;
/* 边线 border */
/* 边线的大小 边线的颜色 边线的类型(实线 solid 和虚线 dashed) */
border:1px #ccc solid;
/* 1、圆角使用 四个角都是20px */
border-radius: 20px;
/* 2、对圆的左上和右下设置10px,右上和左下设置0px */
border-radius: 10px 0;
/* 3、分别对 左上 右上 右下 左下设置圆角 */
border-radius:10px 20px 30px 40px;
/* 4、设置图案为圆形 */
/* 必须是正方形的物体 才能使用 border-radius: 50%; 变圆形 */
width:100px;
height: 100px;
/* 变成圆形 */
border-radius: 50%;
/* border-top: 1px red dashed;
border-bottom: 10px #000 solid; */
}
英文感叹号(!) + tab键
标签名 + tab键
(标签不需要加任何的符号!)
选中要注释的代码,按ctrl+/
标签名*数量 + tab键
假设要生成一个嵌套的表格,表格三行两列:
<table>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
生成的语法:table>tr3>td2
说明: 大于号(>)代表的是包含或者嵌套的意思,也就是说table包含tr标签,然后tr包含td,其中有三个tr标签,每个tr都有2个td。
须知:以上的这种语法在存在嵌套关系的标签中也适用。例如ul>li*3>a 。
如果要快捷选中相同元素编辑,可以先用鼠标选中要选择相同的元素,然后按ctrl+d
快捷键,每按一次就选中一个相同元素。
选择完后,你就可以做相同的操作列。
当光标在当前行时,按ctrl+c
即可复制当前行,然后换一行,再按ctrl+v
粘贴出来即可。
本教程会出电子书,后续敬请期待。