- id 保证标签的唯一性,在整个页面中id不能重复
- class 类,用来选择标签写样式
- name 用在表单元素上面
- style 专门用来设置样式的属性
复制代码<!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>标签的通用属性</title>
</head>
<body>
<input type="text" name="" id="" class="str" value="input1">
<input type="text" name="" id="" class="str" value="input2" style="width: 300px;height: 50px;background-color: rgb(59, 177, 104);">
</body>
<style>
.str{
width: 300px;
height: 50px;
background-color: aqua;
border: 1px solid #fff;
}
</style>
</html>
|