我是靠谱客的博主 难过皮卡丘,这篇文章主要介绍css怎样设置table边框宽度,现在分享给大家,希望可以做个参考。

本教程操作环境:windows7系统、CSS3&&HTML5版、Dell G3电脑。

css怎样设置table边框宽度

我们可以通过border-width属性和border简写属性两种方法来设置table的边框宽度。

1、border-width

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <style> .biaoge1{ border-width:5px 1px 2px 5px; } .biaoge2{ border-width:5px; } </style> <table border="1" class="biaoge2"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> </table> <br/> <table border="1" class="biaoge1"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> </table> </body> </html>
登录后复制

输出结果:

21.png

2、border

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <style> table{ border:5px solid black; } </style> <table border="1"> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> </table> </body> </html>
登录后复制

输出结果:

22.png

(学习视频分享:css视频教程)

以上就是css怎样设置table边框宽度的详细内容,更多请关注靠谱客其它相关文章!

最后

以上就是难过皮卡丘最近收集整理的关于css怎样设置table边框宽度的全部内容,更多相关css怎样设置table边框宽度内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(96)

评论列表共有 0 条评论

立即
投稿
返回
顶部