购物车
效果图
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
table {
text-align: center;
width: 50%;
margin: 0 auto;
border-collapse: collapse;
}
table>caption {
margin-bottom: 20px;
font-size: 1.5rem;
}
th,
td {
border-bottom: 1px solid rgb(99, 99, 99);
padding: 10px 0;
color: #4e4e4e;
font-weight: lighter;
}
tbody>tr:nth-last-of-type(2n) {
background: rgba(194, 194, 194, .2);
}
tbody>tr:hover {
background: lightpink;
}
table>thead {
background: rgba(0, 129, 168, .1);
}
</style>
</head>
<body>
<table>
<caption>清单</caption>
<thead>
<tr>
<th>ID</th>
<th>商品名称</th>
<th>数量</th>
<th>价格</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>罗技(Logitech)M185</td>
<td>1</td>
<td>59</td>
</tr>
<tr>
<td>2</td>
<td>罗技(Logitech)MK275</td>
<td>1</td>
<td>100</td>
</tr>
<tr>
<td>3</td>
<td>技嘉(GIGABYTE)RTX2070</td>
<td>1</td>
<td>6600</td>
</tr>
<tr>
<td>4</td>
<td>戴尔(DELL)U2720QM</td>
<td>1</td>
<td>4200</td>
</tr>
<tr>
<td>5</td>
<td>英特尔(Intel)i9-10900K</td>
<td>1</td>
<td>4499</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">总计:</td>
<td>5</td>
<td>15517</td>
</tr>
</tfoot>
</table>
</body>
</html>
表单实现
效果图
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
* {
padding: 0;
margin: 0;
}
.reg {
width: 30%;
margin: 0 auto;
background: #e6e6e6;
border-radius: 10px;
margin-top: 30px;
}
h1 {
font: 1.2rem;
padding: 10px;
display: block;
text-align: center;
color: #FFF;
background: #008079;
border-radius: 5px 5px 0px 0px;
border-bottom: 1px solid #89AF4C;
margin-bottom: 20px;
}
input,
button {
outline: none;
}
textarea {
width: 100%;
border: 1px solid #e6e6e6;
margin-bottom: 15px;
border-radius: 5px;
padding-left: 10px;
margin-top: 10px;
padding-top: 15px;
}
input[type="search"],
input[type="email"],
input[type="text"] {
width: 80%;
height: 40px;
line-height: 40px;
border: 1px solid #e6e6e6;
margin-bottom: 15px;
border-radius: 5px;
padding-left: 10px;
}
textarea:focus,
input[type="search"]:focus,
input[type='email']:focus,
input[type='text']:focus {
border-color: #66afe9;
outline: 0;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6)
}
.reg-form {
padding: 20px;
}
label>span {
display: inline-block;
width: 84px;
}
.radio_type {
width: 20px;
height: 20px;
appearance: none;
position: relative;
}
.radio_type:before {
content: '';
width: 20px;
height: 20px;
display: inline-block;
border-radius: 50%;
}
.radio_type:checked:before {
content: '';
width: 20px;
height: 20px;
border: 1px solid #008079;
background: #008079;
display: inline-block;
border-radius: 50%;
vertical-align: middle;
}
.radio_type:checked:after {
content: '';
width: 10px;
height: 5px;
border: 2px solid white;
border-top: transparent;
border-right: transparent;
text-align: center;
display: block;
position: absolute;
top: 6px;
left: 5px;
vertical-align: middle;
transform: rotate(-45deg);
}
.radio_type:checked+label {
color: #008079;
}
.radio_type+label {
line-height: 20px;
display: inline-block;
margin-left: 5px;
margin-right: 15px;
color: #333;
}
.mb15 {
margin-bottom: 15px;
}
input[type="checkbox"] {
width: 20px;
height: 20px;
}
button,
input[type="submit"],
input[type="reset"] {
padding: 15px 30px;
border: none;
background: #008079;
color: #fff;
border-radius: 5px;
margin-left: 15px;
}
.btn {
text-align: center;
}
</style>
</head>
<body>
<div class="reg">
<h1>注册</h1>
<form action="" method="post" class="reg-form">
<label for="uname">
<span> 账号:</span> <input type="text" id="uname" name="uname" placeholder="5-10位中文或字母" required>
</label>
<label for="pwd">
<span> 密码:</span> <input type="text" id="pwd" name="pwd" placeholder="6-20位字母+数字" required>
</label>
<label for="repwd">
<span> 确认密码:</span> <input type="text" id="repwd" name="repwd" placeholder="确认密码" required>
</label>
<label for="email">
<span> 邮箱:</span> <input type="email" id="email" name="email" placeholder="example@example.com" required>
</label>
<div class="mb15">
<label for="male"> <span>性别:</span></label>
<input class="radio_type" type="radio" name="gender" value="1" id="male"> <label for="male">男</label>
<input class="radio_type" type="radio" name="gender" value="2" id="female"><label for="female ">女</label>
</div>
<div class="mb15">
<label for="other"><span>爱好:</span></label>
<input type="checkbox" name="checkboox[]" id="basketball" value="basketball"> <label for="basketball">篮球</label>
<input type="checkbox" name="checkboox[]" id="shoot" value="shoot"> <label for="shoot">摄影</label>
<input type="checkbox" name="checkboox[]" id="other" value="other"> <label for="other">其他</label>
</div>
<div class="mb15">
<label for="brand"><span>手机品牌:</span> </label>
<input type="search" list="phone" name="brand" id="brand">
<datalist id="phone">
<option value="apple">
<option value="huawei">
<option value="mi">
</datalist>
</div>
<div class="mb15">
<label for="upload"><span>头像上传:</span> </label>
<input type="file" name="upload" id="upload" accept="image/png, image/jpeg, image/gif">
</div>
<div class="mb15">
<p>
<label for="birthday"><span>生日:</span></label>
<input type="date" id="birthday" name="birthday">
</p>
</div>
<div class="mb15">
<label for="birthday"><span>简历:</span></label>
<textarea name="resume" id="resume" cols="50" rows="10" placeholder="不超过100字"></textarea>
</div>
<div class="btn">
<button>提交</button>
<input type="submit" value="注册" name="submit">
<input type="reset" value="重填" name="reset">
</div>
</form>
</div>
</body>
</html>