-
2022-03-16 15:35:22
layui table表格隐藏控制示例(节选):
html部分(创建一个表格):
<table class="layui-table" style="table-layout:fixed;" id="audio_table"> <colgroup> <col text-align=“center” width="30%"> <col text-align=“center” width="70%"> </colgroup> <tbody> <tr> <td > <label class="layui-form-label" style="left: -55px; top: 10px;" langID="html:video_setting.audio_stream" id="audio_enable"></label> </td> <td> <div class="layui-input-inline" style="top: 5px;"> <input type="checkbox" name="audio_stream" id="audio_stream" lay-filter="audio_stream" lay-text="ON|OFF" lay-skin="switch"> </div> </td> </tr> </tbody> </table>
JS部分:
var audio_enable = document.getElementById('audio_table'); //通过表格ID获取元素 audio_enable.style.display = 'none'; //设置表格隐藏 audio_enable.style.display = ''; //设置表格取消隐藏
更多相关内容 -
使用bootstrap写的关于table表格的显示和折叠效果
2017-11-14 13:54:38使用bootstrap,配合JQ写的关于table表格的显示和折叠效果。点击实现table表格的折叠后,显示+号,再次点击,伸展表格中的内容,并显示-号 -
java实现任意带table表格的html页面,生成与表格相同内容的excel文件
2016-09-23 12:19:15要求能够实现给出任意带table表格的html文件,生成与表格相同内容的excel文件,附件可以作为测试文件,提供给定的roster.html文件,通过java代码,实现生成与html页面的table相同样式的roster.xls文件。 -
element-ui实现table表格的嵌套(table表格嵌套)功能实现
2021-05-19 14:24:38最近在做电商类型的官网,希望实现的布局如下:有表头和表身,所以我首先想到的就是table表格组件。 表格组件中常见的就是:标题和内容一一对应: 像效果图中的效果,只用基础的表格布局是不行的,因此我想到了...最近在做电商类型的官网,希望实现的布局如下:有表头和表身,所以我首先想到的就是
table
表格组件。表格组件中常见的就是:标题和内容一一对应:
像效果图中的效果,只用基础的表格布局是不行的,因此我想到了table
表格中的展开功能:
然后通过:默认展开所有行
然后在里面的表格table
中默认隐藏表头:
其他的则需要通过样式进行实现了element-ui中table表格的嵌套(代码部分)
<el-table v-bind:data="tableData" :default-expand-all="true" class="parentTable" ref="multipleTable" v-loading="loading" element-loading-text="拼命加载中"> <el-table-column type="expand"> <template slot-scope="props"> <div class="conWrap" style="text-align: left;line-height: 16px;font-size: 14px;position: relative;top: -10px;"> <span>订单包号:{{props.row.OrderNo}}</span> <span style="margin-left:42px;">付款时间:{{props.row.CreateTime}}</span> </div> <el-table v-bind:data="props.row.OrderDetails" :default-expand-all="true" stripe :show-header="false" class="childTable"> <el-table-column prop="PartNo" align="center" label="产品型号" width="180"> <template slot-scope="scope"> <div class="name-b">{{scope.row.PartNo}}</div> </template> </el-table-column> <el-table-column prop="Mfg" label="品牌" width="199"> <template slot-scope="scope"> <div class="name-b">{{scope.row.Mfg}}</div> </template> </el-table-column> <el-table-column prop="Package" label="封装" width="114"> <template slot-scope="scope"> <div class="name-b">{{scope.row.Package}}</div> </template> </el-table-column> <el-table-column prop="miaoshu" label="描述" width="300"> <template slot-scope="scope"> <div class="name-b" style="width:100%;">72MHZ 20KB 37 2V~3.6V-40°C~85°C(TA)</div> </template> </el-table-column> <el-table-column prop="ProductNum" align="center" width="120" label="申请数量"> <template slot-scope="scope"> <div class="name-b">{{scope.row.ProductNum}}</div> </template> </el-table-column> <el-table-column prop="maxNum" label="申请状态"> <template slot-scope="scope"> <div> <el-popover trigger="hover" placement="right" v-if="scope.row.State==20||scope.row.State==40"> <p v-if="scope.row.State==20">失败原因: {{ scope.row.FailReason }}</p> <p v-if="scope.row.State==40">物流信息: {{ scope.row.ExpressNo }}</p> <div slot="reference" class="name-wrapper"> {{scope.row.State |fiterState(stateMenu)}} <span v-if="scope.row.State==40" style="margin-left:14px;color:#B77C20;">物流信息</span> <span v-if="scope.row.State==20" style="margin-left:14px;color:#B77C20;">查看原因</span> </div> </el-popover> <div v-else> {{scope.row.State |fiterState(stateMenu)}} </div> </div> </template> </el-table-column> <el-table-column label="操作" width="162"> <template slot-scope="scope"> <div style="display:flex;"> <el-button type="text" size="small" v-on:click="cancel(scope.row)" v-if="scope.row.State==10||scope.row.State==20">取消</el-button> <el-button type="text" size="small" v-on:click="sureHave(scope.row)" v-if="scope.row.State==40">确认收货</el-button> </div> </template> </el-table-column> </el-table> </template> </el-table-column> <el-table-column label="产品型号" align="center" width="180"></el-table-column> <el-table-column label="品牌" width="199"></el-table-column> <el-table-column label="封装" width="114"></el-table-column> <el-table-column label="描述" width="300"></el-table-column> <el-table-column label="申请数量" align="center" width="120"></el-table-column> <el-table-column label="申请状态"></el-table-column> <el-table-column label="操作" align="center" width="118"></el-table-column> </el-table>
最终效果图:
样式部分:
.el-table { border-top: none !important; } .el-table__expanded-cell { padding: 0 !important; } .tableWrap { width: 100%; } .el-tabs__nav-scroll { padding: 0 20px; box-sizing: border-box; } .tableWrap .el-table { width: 1240px; margin: 0 auto; } .el-icon.el-icon-arrow-right { color: #fff; } .el-table__row.expanded { background: #fff !important; position: relative !important; top: -100px !important; border: 1px solid red; } .el-tabs__content { display: none; } .el-table__row.expanded > td { padding: 7px 0; } .el-table__row.expanded { border: 1px solid #E5E5E5; } .el-table__row.expanded:first-child { border-bottom: none; } .childTable .el-table__body { border-top: 1px solid #E5E5E5; } .childTable .el-table__row.expanded > td:first-child { border-left: 1px solid #E5E5E5; } .childTable .el-table__row.expanded > td:last-child { border-right: 1px solid #E5E5E5; } .el-tabs__header.is-top { border-bottom: none; } .childTable .el-table__header-wrapper { display: none; } .conWrap { height: 44px; background: #E5E5E5; line-height: 44px; padding-left: 10px; font-size: 14px; font-family: Microsoft YaHei; line-height: 19px; color: #333333; } .conWrap > span { line-height: 44px; } .el-table .has-gutter .is-leaf { position: relative !important; left: -48px !important; } .el-table .has-gutter .is-leaf:last-child { position: relative !important; left: 0px !important; } .el-table__header-wrapper { background: #EBEBEB; } .el-table .has-gutter > tr > th { background: #EBEBEB; font-size: 14px; font-family: Microsoft YaHei; font-weight: bold; line-height: 19px; color: #333333; }
数据结构
{ "Items":[ { "OrderNo":"ICS-10390-1", "ProductIds":"[646,309118,331385,331393,331394]", "UserId":10390, "Applicant":"( ̄▽ ̄*)b", "ApplicantMobile":"18458192430", "Receiver":"123", "CompanyName":"卡卡卡卡卡12 32 26", "Post":"高管", "Industry":"工业设计", "Purpose":"332", "Province":"广东省", "City":"广州市", "Address":"123", "ContactMobile":"18458192430", "CreateTime":"2021/9/7 8:51", "OrderDetails":[ { "Id":1309, "OrderNo":"ICS-10390-1", "SupplierId":2, "ProductId":331393, "ProductNum":1, "ExpressNo":null, "SendTime":"", "ReceiveTime":"", "JpSkuNo":"JPC47B1332N331393", "PartNo":"cs-454", "Package":"21", "Mfg":"Samsung(三星)", "ProPics":"https://test-jpfile1.oss-cn-shenzhen.aliyuncs.com//IcMall/icmall/2021/4/30/2021043014452714515931.JPG", "CreateTime":"2021/9/7 8:51", "UpdateTime":"2021/9/7 8:51", "IsDeleted":false, "State":10, "CheckTime":null, "FailReason":null, "SupplierName":"深圳前海宝利士科技有限公司", "ExpressCompany":null, "Ship":1 } ] } ], "Queryable":null, "TotalCount":1, "Msg":null }
-
如何让整个table表格居中?
2021-06-08 15:26:50居中最简章的方法就是直接在作用域写上:text-align:center,表格的话直接在table里写上align=center就可以了。不过表格已不是当下布局主流,如果习惯于表格布局的同学们应该尽快适应div+css的布局方式,不仅写法...早期做网站都离开表格的使用,表格的对齐方式居中又是常用属性。居中最简章的方法就是直接在作用域写上:text-align:center,表格的话直接在table里写上align=center就可以了。不过表格已不是当下布局主流,如果习惯于表格布局的同学们应该尽快适应div+css的布局方式,不仅写法简单、灵活,最重要的是能大大提高工作效率,特别是在循环列表数据的时候,比表格可不是强一点。
在全是DIV+CSS布局的今天,使用的表格table的机会越来越少,要知道在十年前网页布局还是TABLE的天下,不管用的广泛与否基础操作可不能忘本呀。如果要想使整个Table表格水平居中应该如何来实现呢?
第一种方法:使用表格自身的对齐方式,也是表格默认的简单操作方式
纯表格代码,借助自身的align="center"属性实现整体的水平居中。
第二种方法:使用CSS样式强制表格居中
1.table表格整个居中
......
我们在table外围div中加入样式style="text-align: center;",会发现table表格居中不生效,WHY?
所以我们在
2.table表格各行各列中内容居中
可以在table外围div中加入样式style="text-align: center;"让表格中内容居中。为了看的清楚可以为table表格设置一个宽度。
或是单独的在
加入样式都能实现。为什么style="text-align: center;"不能使table表格整个居中??
答:我们先要明白。text-align:属性代表的是元素中文本的水平对齐方式,说的更具体点就是设置块级元素内文本的水平对齐方式。只针对文本内容。
本文地址:https://www.up7.com.cn/news/257.html
-
HTML中Table表格的使用与漂亮的表格模板
2019-08-04 18:12:051、表格标记 表格是网页中十分重要的组成元素。表格用来存储数据,包含标题、表头、行和单元格。在HTML语言中,表格标记使用符号<table>表示。定义表格光使用<table>是不够的,还需要定义表格中的行、...1、表格标记
表格是网页中十分重要的组成元素。表格用来存储数据,包含标题、表头、行和单元格。在HTML语言中,表格标记使用符号<table>表示。定义表格光使用<table>是不够的,还需要定义表格中的行、列、标题等内容。
标记 说明 表格标记<table> <table></table>标记表示整个表格。<table>标记中有很多属性,例如 width 属性用来设置表格的宽度,border 属性用来设置表格的边框,align 属性用来设置表格的对其方式,bgcolor 属性用来设置表格的背景色等。 标题标记<caption> 标题标记以<caption>开头,以</caption>结束,标题标记也有一些属性,例如:align、valign 等。 表格行标记<tr> 一组<tr>标记表示表格中的一行。<tr>标记要嵌套在<table>标记中使用,该标记也具有 algin、background 等属性。 表头标记<th> 表头标记以<th>开头,以</th>结束,也可以通过 algin、background、colspan、valign 等属性来设置表头。 单元格标记<td> 单元格标记<td>又称为列标记,一个<tr>标记中可以嵌套若干个<td>标记。该标记也具有 algin、background、valign 等属性。 1.1 显示表格边框
方法一:在<table>标记中添加属性:border="1" cellspacing="0",如下:
<table border="1" cellspacing="0"> </table>
说明:
border="1"表示设置表格边框1px;
cellspacing="0"表示设置表格边框间距为0,即无边距。
方法二:使用CSS样式。
table { border-collapse: collapse;} table,table tr th, table tr td { border:1px solid #000000; }
1.2 合并单元格
colspan 是列合并,rowspan是行合并。
示例:在页面中定义学生成绩表,并在表格中显示边框,同时使用单元格合并。
<html> <head> <title>表格标记</title> <style> table { border-collapse: collapse;} table,table tr th, table tr td { border:1px solid #000000; } </style> </head> <body> <table align="center"> <caption>学生考试成绩单</caption> <tr> <th align="center" valign="middle">姓名</th> <th align="center" valign="middle">语文</th> <th align="center" valign="middle">数学</th> <th align="center" valign="middle">英语</th> </tr> <tr> <td align="center" valign="middle">张三</td> <td align="center" valign="middle">89</td> <td align="center" valign="middle">92</td> <td align="center" valign="middle">87</td> </tr> <tr> <td align="center" valign="middle">李四</td> <td align="center" valign="middle">93</td> <td align="center" valign="middle">86</td> <td align="center" valign="middle">80</td> </tr> <tr> <td align="center" valign="middle">王五</td> <td align="center" valign="middle">85</td> <td align="center" valign="middle">86</td> <td align="center" valign="middle">90</td> </tr> <tr> <th rowspan="2" align="center" valign="middle">博客信息</th> <td colspan="3" align="center" valign="middle">您好,欢迎访问 pan_junbiao的博客</td> </tr> <tr> <td colspan="3" align="center" valign="middle">博客地址:https://blog.csdn.net/pan_junbiao</td> </tr> </table> </body>
执行结果:
2、漂亮的Table表格模板
以下是来自 hipenpal.com 网站提供的一些漂亮的Table表格模板。
更多模板可以访问 hipenpal.com 网站,请点击:漂亮的Table表格模板
模板1:
<style> .table11_7 table { width:100%; margin:15px 0; border:0; } .table11_7 th { background-color:#00A5FF; color:#FFFFFF } .table11_7,.table11_7 th,.table11_7 td { font-size:0.95em; text-align:center; padding:4px; border-collapse:collapse; } .table11_7 th,.table11_7 td { border: 1px solid #2087fe; border-width:1px 0 1px 0; border:2px inset #ffffff; } .table11_7 tr { border: 1px solid #ffffff; } .table11_7 tr:nth-child(odd){ background-color:#aae1fe; } .table11_7 tr:nth-child(even){ background-color:#ffffff; } </style> <table class=table11_7> <tr> <th>SAMPLE</th><th>SAMPLE</th><th>SAMPLE</th> </tr> <tr> <td>SAMPLE</td><td>SAMPLE</td><td>SAMPLE</td> </tr> <tr> <td>SAMPLE</td><td>SAMPLE</td><td>SAMPLE</td> </tr> <tr> <td>SAMPLE</td><td>SAMPLE</td><td>SAMPLE</td> </tr> <tr> <td>SAMPLE</td><td>SAMPLE</td><td>SAMPLE</td> </tr> </table>
执行结果:
模板2:
<style> .table11_6 table { width:100%; margin:15px 0; border:0; } .table11_6 th { background-color:#96C7ED; color:#000000 } .table11_6,.table11_6 th,.table11_6 td { font-size:0.95em; text-align:center; padding:4px; border-collapse:collapse; } .table11_6 th,.table11_6 td { border: 1px solid #73b4e7; border-width:1px 0 1px 0; border:2px inset #ffffff; } .table11_6 tr { border: 1px solid #ffffff; } .table11_6 tr:nth-child(odd){ background-color:#dcecf9; } .table11_6 tr:nth-child(even){ background-color:#ffffff; } </style> <table class=table11_6> <tr> <th>SAMPLE</th><th>SAMPLE</th><th>SAMPLE</th> </tr> <tr> <td>SAMPLE</td><td>SAMPLE</td><td>SAMPLE</td> </tr> <tr> <td>SAMPLE</td><td>SAMPLE</td><td>SAMPLE</td> </tr> <tr> <td>SAMPLE</td><td>SAMPLE</td><td>SAMPLE</td> </tr> <tr> <td>SAMPLE</td><td>SAMPLE</td><td>SAMPLE</td> </tr> </table>
执行结果:
模板3:
<style> .table11_3 table { width:100%; margin:15px 0; border:0; } .table11_3 th { background-color:#FF5675; color:#FFFFFF } .table11_3,.table11_3 th,.table11_3 td { font-size:0.95em; text-align:center; padding:4px; border-collapse:collapse; } .table11_3 th,.table11_3 td { border: 1px solid #fe2047; border-width:1px 0 1px 0; border:2px inset #ffffff; } .table11_3 tr { border: 1px solid #ffffff; } .table11_3 tr:nth-child(odd){ background-color:#fec6d1; } .table11_3 tr:nth-child(even){ background-color:#ffffff; } </style> <table class=table11_3> <tr> <th>SAMPLE</th><th>SAMPLE</th><th>SAMPLE</th> </tr> <tr> <td>SAMPLE</td><td>SAMPLE</td><td>SAMPLE</td> </tr> <tr> <td>SAMPLE</td><td>SAMPLE</td><td>SAMPLE</td> </tr> <tr> <td>SAMPLE</td><td>SAMPLE</td><td>SAMPLE</td> </tr> <tr> <td>SAMPLE</td><td>SAMPLE</td><td>SAMPLE</td> </tr> </table>
执行结果:
-
boostrapTable表格树
2018-01-13 21:39:18boostrapTable表格树,官网上有,但是如果未来方便也可以下载,毕竟js和css齐全可以直接运行出效果 -
css控制table表格宽度的小技巧教程
2021-02-04 21:57:24对table表格宽度定义有直接table标签内使用width宽度属性定义其宽度,另外也可以通过css样式设置定义其宽度,根据需要可选择自己适用的定义宽度方法。一、html table标签内宽度定义我们直接在tabl... -
table表格自适应高度的办法
2021-06-08 16:26:09这篇文章主要为大家详细介绍了table表格自适应高度的办法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下,有需要的朋友可以收藏方便以后借鉴。关于自适应高度,361源码在以前给大家介绍过iframe的自适应高度的... -
Grafana table 表格配置方法
2021-01-21 14:34:35使用 table panel 展示文件系统的使用率,这个指标只关心当前值。 在 Query tab 设置 Format 为 Table,勾选 Instant Panel tab 的 Visualization 选择 Table Transform tab 隐藏不显示的列 Field tab 设置 Cell... -
table表格样式
2020-04-08 15:20:41<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> table.tftable, table.table-count { ... -
vxe-table vue table 表格组件功能
2020-12-22 18:18:46一个功能更加强大的 Vue 表格组件功能点•基础•尺寸•斑马线条纹•带边框•单元格样式•列宽拖动•流体高度•固定表头•固定列•固定表头和列•表头分组•序号•单选•多选•排序•筛选•合并行或列•表尾合计•... -
table表格数据绑定
2019-04-18 08:59:45table表格数据绑定 开发工具与关键技术:VS、table表格数据绑定 作者:黄桂康 撰写时间:2019.04.16 上一次我们也讲了关于表格数据绑定的有关文章,但本篇是全表格数据绑定的介绍,table表格是我们经常用到的一种... -
漂亮的table表格样式
2010-06-16 09:06:43非常漂亮 实现简单 亮蓝色 鼠标移动变色 -
网页中table表格如何修改边框颜色
2021-06-11 18:17:24table表格是网页制作中以前较常使用的一种布局方式,但随着DIV+CSS的兴起,table表格已辉煌不在。但它在我们制作网页中也是时有用到。table表格也可以使用DIV一样随意的设置它的边框颜色。我们使用DW打开一个HTML... -
微信小程序做Table表格
2019-08-30 10:49:08实现效果:表格头部固定,表格内容数据可以滚动 ...view class="table"> <view class="tr"> <view class="td">序号</view> <view class="td">唯一XX</view> <... -
html table表格设置滚动条
2021-08-24 13:33:02table对tbody进行设置使其能够进行滚动。 效果如下: 代码如下: <!DOCTYPE HTML> <html> <head> <meta ...表格滚动</title> <style> table,tbody { disp -
ant-design-vue table 表格组件错位解决
2022-04-23 14:20:58ant-design-vue table 表格组件错位解决原因查找错位消失机制解决思路试验一试验二解决的背后 table组件错位问题。 table组件错位,不管是用element-ui的table组件,还是ant的table组件,只要使用了列的fixed属性,... -
Html——之table表格
2020-06-28 20:30:47表格(table)的应用: 表格的创建: <!doctype html> <html> <head> <meta charset="utf-8"> <title>test1</title> <--表格标记--> </head> <body> <... -
table 表格边框合并为单一的边框的方法
2021-06-12 18:36:25在 html table 表格元素的默认设置中,如果为每个表格定义它的边框,整体看起来就感觉非常的凌乱,所以这篇博文就说一说,如果将 table 表格的单元格边框合成一条单线。table 表格边框默认的样式例代码:html>... -
移动端简易的table表格
2020-05-15 15:04:40<template> <view> <view class="flex ac Dark" style="color: white;"> <view class="p-2 " style="width:25%;text-align: center;"> 房间号 <... 业绩金额 -
h5 Table表格
2020-04-15 19:09:24table:表格 tr:行rowspan:占据行数 td列 clospan:占据列数 th表头(浏览器默认样式粗体居中) caption标题(浏览器默认样式居中) -
Flutter Table 表格
2019-07-23 10:24:56Table 是一个表格布局组件,官方有话说:如果您只有一行,则Row小部件更合适。如果您只有一列,则SliverList或Column小部件将更合适。 参数详解 属性 说明 children List<TableRow>表的行 ... -
echart数据视图以table表格展示
2021-01-15 13:45:46==){+='}else{+='}}+='++'=''}+=' ' tdHeads ' i l axisDatalength i l i j j serieslength j temp seriesjdatai temp temp undefined tdBodys ' + temp + '' tdBodys ' table ' + axisData[i] + '' tdBodys ' ... -
html中table表格分页
2021-06-16 03:30:41表格分页//注:样式有点丑,但是功能是实现的,按照的是每页显示10数据加一行表头varmytable;varmy_new_table;var my_href1;var my_href2;var temp1=0;var temp2=0;var flag1 = false;var flag2 = false;var flag3 = ... -
html里table表格里嵌套table表格
2019-05-08 14:00:48<table class="layui-table" lay-size="sm"> <thead> <tr> <th>订单编号</th> <th>订单创建时间</th> <th>机器名</t... -
element ui table表格轮播
2021-05-25 09:41:00element ui 用table表格示例不用添加任何语法,配上我下方的方法就没可以轻松实现表格轮播效果: 这个方法放在methods()方法里然后在mounted()中调用就可以了,注意我方法里rightData数据和绑表格的数据是一致的! ... -
jQuery+js 实现Table表格可任意拖动调整列宽度大小 适用于列表页等表头拖动宽度设置
2013-09-23 17:25:48jQuery+js 实现Table表格可任意拖动调整列宽度大小 适用于列表页等表头拖动宽度设置,完美兼容IE,FireFox,Google Chrome浏览器。 -
antdesign vue中table表格选中项的清除问题
2022-03-31 20:57:00最近做项目的时候用到了antdesign 框架中的table表格,可以选择表格项 从antd官网复制的下面方法,点击其他按钮刷新selectedRowKeys发现清除不了选中项的缓存 如下图所示,选中项再打开页面仍然存在 问题描述 按照... -
html之表格详解及table表格实现页面布局
2021-01-18 15:24:521、table>标签:声明一个表格,它的常用属性如下: border属性 定义表格的边框,设置值是数值 cellpadding属性 定义单元格内容与边框的距离,设置值是数值 cellspacing属性 定义单元格与单元格之间的距离,设置值...