Html 列的宽度与样式中指定的宽度不同
我有以下列的标记:Html 列的宽度与样式中指定的宽度不同,html,css,Html,Css,我有以下列的标记: <table class="b-hdfs__files-list"> <colgroup> <col span="1" class="b-hdfs__files-list__item-property-col-width-selected"> <col span="1" class="b-hdfs__files-list__item-property-col-width-type">
<table class="b-hdfs__files-list">
<colgroup>
<col span="1" class="b-hdfs__files-list__item-property-col-width-selected">
<col span="1" class="b-hdfs__files-list__item-property-col-width-type">
<col span="1" class="b-hdfs__files-list__item-property-col-width-name">
<col span="1" class="b-hdfs__files-list__item-property-col-width-size">
<col span="1" class="b-hdfs__files-list__item-property-col-width-user">
<col span="1" class="b-hdfs__files-list__item-property-col-width-group">
<col span="1" class="b-hdfs__files-list__item-property-col-width-permissions">
<col span="1" class="b-hdfs__files-list__item-property-col-width-date">
</colgroup>
但是,尽管每一列都像预期的那样相等,但它们的宽度不是50px,而是33px。我想知道为什么。以下是完整的标记和样式。问题在于:
.b-hdfs__files-list {
width: 100%;
}
请尝试使用此选项:
.b-hdfs__files-list {
width: auto;
}
问题是:
.b-hdfs__files-list {
width: 100%;
}
请尝试使用此选项:
.b-hdfs__files-list {
width: auto;
}
因为您已经为表格指定了100%的宽度,所以它正在根据它进行调整。
因此,删除
宽度:100%在.b-hdfs\uuu文件列表中编码>并给出宽度:100px代码>(您的选择)用于col
s 因为您为表格指定了100%的宽度,所以它正在根据它进行调整。
因此,删除宽度:100%在.b-hdfs\uuu文件列表中编码>并给出宽度:100px代码>(您的选择)用于col
s 我不确定这是否有效,但我认为它会:
.b-hdfs__files-list {
width: 100%;
}
.b-hdfs__files-list {
width: auto;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-selected {
width: 15px;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-type {
width: 15px;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-name {
width: 15px;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-size {
width: 15px;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-user {
width: 15px;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-group {
width: 15px;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-permissions {
width: 15px;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-date {
width: 15px;
}
.b-hdfs__files-list__header {
text-align: left;
height: 32px;
border-bottom: 1px solid #c7d0d9;
}
.b-hdfs__files-list__item {
line-height: 32px;
cursor: pointer;
border-bottom: 1px solid #c7d0d9;
}
.b-hdfs__files-list__item:hover {
background-color: #E8F1FB;
}
.b-hdfs__files-list__item-property {
color: #494a4c;
}
.b-hdfs__files-list__item-property__name {
font-weight: bold;
}
我不确定这是否可行,但我认为它会:
.b-hdfs__files-list {
width: 100%;
}
.b-hdfs__files-list {
width: auto;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-selected {
width: 15px;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-type {
width: 15px;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-name {
width: 15px;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-size {
width: 15px;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-user {
width: 15px;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-group {
width: 15px;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-permissions {
width: 15px;
}
.b-hdfs__files-list .b-hdfs__files-list__item-property-col-width-date {
width: 15px;
}
.b-hdfs__files-list__header {
text-align: left;
height: 32px;
border-bottom: 1px solid #c7d0d9;
}
.b-hdfs__files-list__item {
line-height: 32px;
cursor: pointer;
border-bottom: 1px solid #c7d0d9;
}
.b-hdfs__files-list__item:hover {
background-color: #E8F1FB;
}
.b-hdfs__files-list__item-property {
color: #494a4c;
}
.b-hdfs__files-list__item-property__name {
font-weight: bold;
}
您可以将表格布局:固定
添加到您的表格中您可以将表格布局:固定
添加到您的表格中