Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/82.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 列的宽度与样式中指定的宽度不同_Html_Css - Fatal编程技术网

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;
}

您可以将
表格布局:固定
添加到您的表格中

您可以将
表格布局:固定
添加到您的表格中