lable 标签
lable标签用于绑定一个表单元素,当点击<lable>
标签内文本时,浏览器自动将光标转移到对应表单元素上。
<label for="username">用户名:</label> <input type="text" name="username" maxlength="3" id="username" >
lable标签的for属性应和相关元素的id属性一致
select下拉元素
slect定义下拉列表
<select>
<option> 选项1 </option>
<option> 选项2 </option>
<option> 选项3 </option>
</select>
select中至少包含一对option
option中定义selected = “selected”时当前选项即为默认选项
<textarea> </textarea>
创建多行文本输入框
css 样式表
CSS写在style标签里位于head标签中
css规则主要有两部分组成
1.选择器(给谁修改)2.属性(改成什么样)
h1 { color : red }
选择器
1.基础选择器
2.类选择器
<style>
.red {
color: red;
}
</style>
<li class="red">111</li>
<li>111</li>
<li>111</li>
<li>111</li>
<li>111</li>
多类名
id选择器
样式#定义,结构id调用,只能调用一次,别人切勿使用。
通配符选择器
*{
}
字体属性
- 字体系列:用font-family定义
- 字体大小:font-size,默认单位px,可以用body指定整个页面大小(标题标签 比较特殊,需要手动指定文字大小)
- 字体粗细:font-weight normal(默认值等于400),bold(加粗的等于700)
- 文字样式:font-style norma(默认值不倾斜)italic(倾斜)
-
CSS文本属性
- 文本颜色:color属性
- 对齐文本:text-align(水平对齐)left:左对齐,right:右对齐,center:中心
- 装饰文本:text-decoration none(没有下划线)underline(下划线)
- overline(上划线)line-through(删除线)
- 文本缩进:text-indent 单位:em(一个文字的大小)
- 行间距:line-height
CSS引入方式
外部样式表
<link rel = 'styleshet' herf='css文件路径'>