首页
关于
统计
推荐
百度一下
腾讯视频
Search
1
mongodb使用:安装、修复服务、账号鉴权访问、增删改查
215 阅读
2
CSS代码片段:表格应用,图片垂直居中
175 阅读
前端技术
css
登录
Search
标签搜索
CSS
html
代码片段
逆向人
累计撰写
2
篇文章
累计收到
75
条评论
首页
栏目
前端技术
css
页面
关于
统计
推荐
百度一下
腾讯视频
搜索到
1
篇与
代码片段
的结果
2024-07-11
CSS代码片段:表格应用,图片垂直居中
图表垂直居中.img-container { line-height: 300px; height: 300px; font-size: 0; text-align: center; background-color: chocolate; } .img-container img { height:96px; display: inline-block; vertical-align:middle; padding:0 10px; } <div class="img-container"> <div> <img src="1.png" alt="1"> <img src="1.png" alt="2"> </div> </div>效果表格代码片段表头+第二行三列+第三行四列<style> table { border-collapse: collapse; width: 100%; } th, td { border: 1px solid black; padding: 8px; text-align: left; } th { border: none; /* 移除表头的边框 */ } .no-border { border: none; /* 移除特定单元格的边框 */ } .single-border td { border-right: none; /* 移除右边框 */ } .single-border td:last-child { border-right: 1px solid black; /* 最后一列保留右边框 */ } </style> <table> <tr> <th>Header 1</th> <td class="no-border"></td> <td class="no-border"></td> <td class="no-border"></td> </tr> <tr class="single-border"> <td>Cell 1</td> <td>Cell 2</td> <td>Cell 3</td> </tr> <tr class="single-border"> <td>Cell 1</td> <td>Cell 2</td> <td>Cell 3</td> <td>Cell 4</td> </tr> </table>效果:表头+第二行二列(1、3格,2、4格空) + 第三行四列<style> table { border-collapse: collapse; width: 100%; } th, td { border: 1px solid black; padding: 8px; text-align: left; } th { border: none; /* 移除表头的边框 */ } .no-border { border: none; /* 移除特定单元格的边框 */ } .single-border td { border-right: none; /* 移除右边框 */ } .single-border td:last-child { border-right: 1px solid black; /* 最后一列保留右边框 */ } </style> <table> <tr> <th>Header 1</th> <td class="no-border"></td> <td class="no-border"></td> <td class="no-border"></td> </tr> <tr> <td>Cell 1</td> <td class="no-border"></td> <td>Cell 2</td> <td class="no-border"></td> </tr> <tr class="single-border"> <td>Cell 1</td> <td>Cell 2</td> <td>Cell 3</td> <td>Cell 4</td> </tr> </table>效果
2024年07月11日
175 阅读
27 评论
0 点赞