Web前端编程学习
HTMl部分
2021.1.11 P1 - P8
一、标签学习
- 编写工具:HbuilderX
- <!DOCTYPE > <!-- ...--> : 注释
- <h1> 标题 </h1> : h1 - h6 从大到小 1-6级标签
- <i> 斜体 </i>
- <hr > : 分割线(单标签)
- <p> 换行 </p>
- <b>加粗</b>
- <br> : 换行 (单标签)
- : 空格
- <img src=" "> : 插入图片
- <img src=" " title = "鼠标放上去显示的文字">
- <img src=" " alt = "图片加载不出来显示的文字">
- <ul> </ul>无序列表项
- <ul type = "disc"> </ul> (实心圆,默认样式)
- <ul type = "circle"> </ul> (空心圆)
- <ul type = "square"> </ul> (实心方块)
- <ol> </ol>有序列表项
- <ol type = " 1 "> </ol> (阿拉伯数字,默认样式)
- <ol type = " A "> </ol> (大写英文字母)
- <ol type = " a "> </ol> (小写英文字母)
- <ol type = "Ⅰ"> </ol> (大写罗马字母,默认样式)
- <ol type = " i "> </ol> (小写罗马字母,默认样式)
- <li>列表项</li>
- <a href = " 链接 "> 标题 < /a> :超链接
- <a href = " 链接 " target = "_blank"> 标题 < /a> (新标签页打开)
- <a href = " 链接 " > 标题 < /a> (当前标签页打开)
- <del> 删除线 </del>
- <sup>右上角标</sup>
- <u> 下划线 </u>
- <center> 居中 < /center>
二、图片的使用
- width : 宽度 eg:100px or 100%
- eg <img src=" " width = 100px>
- height : 高度 eg:100px or 100%
- <img src=" " height = 100%>
- 下载图片:
2021.1.12 P9 - P14
三、绝对路径和相对路径
- ../返回上级目录
四、单元格
- <table> </table>
- <tr>...</tr> : 表示一行
- <td>...</td> :表示单元格
- <col> : 表示一列
- <table border="1px" cellspacing="0" cellpadding="0">
- border :表格边框宽度
- cellspacing : 单元格子之间的空白距离
- cellpadding :单元格bai子的内容与du单元格子四边边界之间空白zhi距离
- <tr align="center">
- left = 左对齐内容(默认值)。
- right = 右对齐内容。
- align = 单元格内容的对齐方式
- justify = 对行进行伸展,这样每行都可以有相等的长度(就像在报纸和杂志中)。
- char = 将内容对准指定字符。
- <tr height="40px">
- height : 单元格高度
- <td colspan="7" >...</td>
- colspan : 行合并
- <td rowspan="4"> ... </td>
- rowspan : 列合并
- <th>...</th> = 加粗并水平居中的<td>...</td>
- <colgroup span = "6" width="100px>
- colgroup : 将XX列分为一组,同时修改宽度
五、标签的嵌套
- 超链接不能嵌套超链接
- P标签不能嵌套P标签
- 标签H1...H6也不能互相嵌套
六、表单
- <form action="..." method="post">
- form必须有action属性,表示提示地址
- <form action="..." method="post"> or <form action="..." method="get">
- get请求通常表示获取数据
- post请求通常表示提交数据
- get请求发送的数据都写在地址栏上,用户可见
- post请求发送的数据用户不可见
- get请求不能提交大量数据,但post可以,因此不能混用
- <input type="text" name="logitname">
- 所有需要提交的数据,input必须有name属性
- <input type="submit" value="提交">
- input按钮的文字用value表示
- input必须放在form标签内才能提交
- input常见类型:
- type = "text" : 文本输入框
- type = "password" : 密码输入框
- type = "radio" : 单选框
- type = "checkbox" :复选框
- type = "button" :普通按钮
- type = "submit" :提交按钮
- type = "reset" :重置按钮
- type = "file" : 文件选择框
CSS部分
一、样式表
- style:表示风格、样式
- <input type="submit" value="提交" style="width: 80px; height: 30px; background-color: darkseagreen;">
- text-align: center; 让内部元素水平居中
- margin:auto; 让元素本身水平居中
- background-color :gray; 设定背景颜色
- font-size:24px; 设定字体大小
- color: white;设定文字颜色
二、选择器
- #box:ID选择器
- .nav:类(别)选择器
- div:标签选择器
- *: 通用选择器
- 选择器优先级
-
行内样式表 <...style="..."> > ID选择器 #box{...} > 类别选择器 .con{...} > 标签选择器 div{...} > 通用选择器 *{...}
-
三、文本属性
- colo : red 文字颜色
- font-famoly : "华文中央" 字体类型
- font-size : 26 px 字体尺寸
- font-weight :bold 文字加粗
- font-style :italic :文字倾斜
- text-indent :60px 首行缩进
- text-align:center 水平对齐
- line-height :100px 行高
- height :100px ; line-height :100px; background-color : gray :垂直居中 背景灰色
- text-decoration :underline : 下划线