图片
代码
<!DOCTYPE html>
<html>
<head>
<title>商品列表</title>
<style type="text/css">
table{
border-spacing: 0;
}
table thead{
background-color: lightblue;
}
tbody tr:nth-of-type(2n){
background-color: #ddd;
}
tbody tr td:nth-of-type(4){
text-align: center;
}
.prolist{
width: 600px;
margin:0 auto;
}
tbody td a{
width: 16px;
height: 16px;
background-color: #aaa;
text-decoration-line: none;
border-radius: 3px;
display: inline-block;
text-align: center;
}
</style>
</head>
<body>
<?php
$proList=[
['id'=>'001','name'=>'奶茶','price'=>30],
['id'=>'002','name'=>'汉堡','price'=>20],
['id'=>'003','name'=>'六个圈','price'=>10],
['id'=>'004','name'=>'咖啡','price'=>15]
];
?>
<div class="prolist">
<table>
<caption>商品列表</caption>
<thead>
<tr>
<th width="80px">商品编号</th>
<th width="70px">商品名称</th>
<th width="40px">价格</th>
<th width="120px">添加到购物车</th>
</tr>
</thead>
<tbody>
<?php foreach ($proList as $v): ?>
<tr>
<td><?=$v['id'] ?></td>
<td