时间:2021-07-01 10:21:17 帮助过:41人阅读
和 | )
二、示例代码1、普通表格1 DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="UTF-8"> 5 <title>display普通表格title> 6 <style type="text/css"> 7 .table, .table * {margin: 0 auto; padding: 0;font-size: 14px;font-family: Arial, 宋体, Helvetica, sans-serif;} 8 .table {display: table; width: 80%; border-collapse: collapse;} 9 .table-tr {display: table-row; height: 30px;} 10 .table-th {display: table-cell;font-weight: bold;height: 100%;border: 1px solid gray;text-align: center;vertical-align: middle;background-color:#E5E5E5;} 11 .table-td {display: table-cell; height: 100%;border: 1px solid gray; text-align: center;vertical-align: middle;} 12 style> 13 head> 14 <body> 15 <div class="table"> 16 <div class="table-tr"> 17 <div class="table-th">省份/直辖市div> 18 <div class="table-th">GDP(亿元)div> 19 <div class="table-th">增长率div> 20 div> 21 <div class="table-tr"> 22 <div class="table-td">广东div> 23 <div class="table-td">72812div> 24 <div class="table-td">8.0%div> 25 div> 26 <div class="table-tr"> 27 <div class="table-td">河南div> 28 <div class="table-td">37010div> 29 <div class="table-td">8.3%div> 30 div> 31 <div class="table-tr"> 32 <div class="table-td">江苏div> 33 <div class="table-td">70116div> 34 <div class="table-td">8.5%div> 35 div> 36 div> 37 body> 38 html>
运行效果
2、列合并实现表格实现思路:基于display:table的表格实现,没有 |
---|