HTML标题是通过h1-h6标签定义的。
<h1>一级标题h1>
<h2>二级标题h2>
<h3>三级标题h3>
HTML 链接是通过a标签来定义的。
<div>
<a href="https://www.baidu.com">跳转到百度a>
div>
<div>
<a href="https://www.baidu.com" target="_blank">跳转至百度a>
div>
HTML图像是用img标签定义的。
<img src="img01.jpg" alt="图片显示错误" width="200" height="100">
HTML 元素以开始标签起始,以结束标签终止,
元素的内容是开始标签与结束标签之间的内容。
<h1>今天是个好日子h1>
元素分3类:行元素、块元素、行内块元素;这3类元素可以通过display属性进行任意转换。
display:inline; /*转换为行内元素*/
display:block; /*转换为块状元素*/
display:inline-block; /*转换为行内块状元素*/。
| 名字 | 例子 | 特点 |
|---|---|---|
| 行元素 | a,span | 不能设置宽高,宽高取决于元素本身的内容。多个元素占用一行,最后会自动换行。 |
| 块元素 | di,p,h1—h6。 | 独占一行,可以设置宽高。如果不设置宽高,宽度就继承父元素的宽度,高度是0。如果有内容,高度就是内容的高度。 |
| 行内块元素 | button,input,img。 | 既有行元素的特性,也有块元素的特性。可以为元素设置宽高,不独占一行,多个行内块会左右排列。 |
外边距重叠的条件?
1,必须是块元素,
2,必须是向下的外边距,
3,没有边框。
列表有三类:有序列表(ol标签)、无序列表(ul标签)、定义列表(dl标签)
/* 删除列表项的前缀。 */
list-style:none;
<ol>
<li>Firefoxli>
<li>Edgeli>
<li>googleli>
ol>
<ul>
<li>Firefoxli>
<li>Edgeli>
<li>googleli>
ul>
<dl>
<dt>htmldt>
<dd>vue是当今最流行的前端框架之一dd>
dl>
| 标签 | 描述 |
|---|---|
| table | 块元素,显示一个表格。 |
| tbody | 表主体 |
| thead | 表头部,显示表的头部数据。 |
| tr | 代表一行 |
| th | 代表表头中的一个单元格 |
| td | 代表表主体的一个单元格 |
<td rowspan="2">张三td>当前td所占的行高是两行的高度
<td colspan="2">25td>表示当前单元格要占用两列的宽度
input:输入框,行内块元素。placeholder:提示内容。
<input type="text" placeholder="请输入账号">
button:按钮,行内块元素。
<button>按钮button>
lable标签:用于关联一个其他的表单元素,for属性需要写关联元素的id,点击lable相当于点击了关联的元素。
<label for="psw">密码:label>
radio:单选框,处在同一组的单选框只能选一个值。
<input type="radio" name="city">
<label for="">上海label>
<input type="radio" name="city">
<label for="">深圳label>
<input type="radio" name="city">
<label for="">北京label>
<input type="radio" name="city">
chechbox:复选框,可以多选。
<label for="">香蕉label>
<input type="checkbox">
<label for="">苹果label>
<input type="checkbox">
<label for="">西瓜label>
<input type="checkbox">
select:下拉列表,行内块。
option:下拉列表项。
<select id="nvyou">
<option>小明option>
<option>小红option>
<option>小刚option>
select>