问题描述
在我的 Bootstrap 3 项目中,我需要一个以 px 为单位的固定列宽的表格.我的表中的每个
style=##px
但它没有分配它.我试过将 style="width:auto; overflow: scroll;"
添加到表格中,但它不起作用.还尝试删除我桌子上的每个班级,但列不会增长.I need a table with fixed column widths in px on my Bootstrap 3 project. Every <th>
in my table <table id="items" class="table table-striped table-condensed">
has style=##px
but its not assigning it. I've tried adding style="width:auto; overflow: scroll;"
to the table but it does't work. Also tried removig every class on my table but colums wont grow.
请帮忙!
推荐答案
您可以指定一个 部分:
You could specify a <colgroup>
section:
<table>
<colgroup>
<col span="1">
<col span="1">
</colgroup>
...
</table>
... 然后在 CSS 中设置列的宽度:
... and then set the width of your columns in CSS:
col {
width:200px;
}
如果您在 table 元素上使用 bootstrap .table
类,您还需要将表格的宽度设置为 auto
.
If you are using the bootstrap .table
class on the table element, you will also need to set the width of your table to auto
.
请参阅此 jsfiddle.
这篇关于Bootstrap 3 表,使用滚动条以 px 为单位设置固定列宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
-
maven-tomcat7-plugin会生成损坏的可执行JAR
-
当应用程序未运行时,FCM 显示默认消息而不是自定义消息
-
使用 ImageIO.write jpg 文件的问题:粉红色背景
-
在 MXML 图形中绘制圆弧
-
在PostgreSQL中将列数据类型从Text更改为Integer
-
如何获得两种颜色之间的颜色?
-
ActionBar 的像素大小是多少?
-
在excel中使用条件格式函数中的公式
-
MySQL:拒绝访问用户'userName'@'localhost'
-
签入 TFS 2013 之前的代码审查
-
继续获取"tsc.exe";用代码1退出
-
打印时保留HTML字体颜色 - IE设置,不是打印机问题
-
javascript中的反向十进制数字
-
ZonedDateTime到UTC并应用了偏移量?
-
引导菜单崩于阿贾克斯的网站。如何关闭菜单上的每一个点击?