您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

HTML中新建表格怎么加背景

2025/10/15 17:48:57发布16次查看
在html中,可以使用background属性设置新建表格中的背景,只需要给表格元素设置“background:属性值”即可。background属性在一个声明中设置所有的背景属性,可以设置对象为纯色的背景颜色,也可以设置图片为背景。
本教程操作环境:windows7系统、css3&&html5版、dell g3电脑。
表格的颜色设置非常简单,和文字的颜色设置完全一样。
css通过background属性设置表格的背景;通过color属性设置表格中文字的颜色。
示例:
<!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>document</title> <style> body { background-color: #ebf5ff; margin: 0px; padding: 4px; text-align: center; } table { background: pink; color: white; } </style> </head> <body> <table border="1"> <tr> <th>name</th> <th>age</th> <th>number</th> </tr> <tr> <td rowspan="2">xm</td> <td>10</td> <td>2020</td> </tr> <tr> <td>3</td> <td>2021</td> </tr> <tr> <td>xf</td> <td>4</td> <td>2010</td> </tr> </table> </body></html>
效果:
推荐学习:html视频教程
以上就是html中新建表格怎么加背景的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product