Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/72.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_Html Table - Fatal编程技术网

将最小大小限制为html表

将最小大小限制为html表,html,css,html-table,Html,Css,Html Table,我有一个问题,我需要制作无限拉伸尺寸的桌子,但我需要为它们定义最小宽度,以便我可以看到它们。当它们缩小到原来大小的50%时,它们将停止使用浏览器窗口缩小并滚动查看。我希望您能理解,以下是我的html代码: .vnutro{ 左边距:100px; 边缘顶部:20px; 最大宽度:90%; 最小宽度:50%; } th{ 边框:1px纯黑; 最大宽度:100px; 最小宽度:60px; } .th1{ 宽度:25%; } .th2{ 宽度:65%; } .th3{ 宽度:2%; } .th4{ 宽

我有一个问题,我需要制作无限拉伸尺寸的桌子,但我需要为它们定义最小宽度,以便我可以看到它们。当它们缩小到原来大小的50%时,它们将停止使用浏览器窗口缩小并滚动查看。我希望您能理解,以下是我的html代码:

.vnutro{
左边距:100px;
边缘顶部:20px;
最大宽度:90%;
最小宽度:50%;
}
th{
边框:1px纯黑;
最大宽度:100px;
最小宽度:60px;
}
.th1{
宽度:25%;
}
.th2{
宽度:65%;
}
.th3{
宽度:2%;
}
.th4{
宽度:2%;
}
运输署{
边框:1px纯黑;
文本对齐:左对齐;
}

nadpis1
nadpis 2
nadpis 3
nadpis 4
文本1
文本2
文本3


如果我正确理解了您的问题,那么请尝试将以下内容添加到CSS中,以查看这是否为您提供了所需的结果

table {
   width: 100%;
   table-layout: fixed;
}

更多信息。

首先,在您提到的链接中。你的代码中有很多错误。所以我把它修好了

注:根据需要调整宽度

以下是更新的代码:

 <div class="vnutro" style="overflow-x:auto;"> 
     <a name="1072016">
     <!--tabulka 1-->
     <table border="1" cellspacing="0" cellpadding="0" border="0" width="500">
         <tr>
             <th class="th1"> nadpis1 </th>
             <th class="th2"> nadpis 2 </th>
             <th class ="th3"> nadpis 3 </th>
             <th class="th4"> nadpis 4 </th>
         </tr>
            <td width="100"> text1 </td>
            <td width="100"> text2 </td>
            <td width="100"> text3 </td>
            <td width="100">
                <form action="">
                    <input type="checkbox" name="checkbox" value="box">
                </form>
            </td>
     </table>
     </a>
     <a name="1172016"></a>
     <!--tabulka 2-->
     <br/>
     <a name="1272016"></a>
     <!--tabulka 3-->
 </div>


.

这是我的全部代码,如果对您有帮助的话。 HTML:
CSS:

此示例延伸至全宽,但最小宽度为400px,列可以具有相同或不同的宽度

表格{
最小宽度:400px;
宽度:100%;
}
th{
边框:1px纯黑;
}
th{
宽度:25%;
}
运输署{
边框:1px纯黑;
文本对齐:左对齐;
垂直对齐:顶部;
}
/*表2*/
[name=“1172016”]~表th{
宽度:20%;
}
[name=“1172016”]~表th:n子项(1){
宽度:40%;
}

表1
nadpis1
nadpis 2
nadpis 3
nadpis 4
文本1
文本2
文本3

表2 nadpis1 nadpis 2 nadpis 3 nadpis 4 文本1 文本2 文本3
不,它不工作,我需要用浏览器窗口阻止它收缩。我需要它对浏览器窗口做出响应,但当它达到50%时,比如说,表格标题和表格数据将停止随着浏览器收缩,它们将保持在那个大小,直到我再次使浏览器窗口变大。我需要保持每个表格的宽度不变。它们只会随着浏览器窗口收缩,直到达到原来大小的50%,然后它们就会停止收缩。谢谢你的帮助!好的,现在在电话上-如果你没有答案,我会稍后再看。到时候你也会有很多html语法错误。无论如何,当列宽适合其内容时,列将停止收缩。非常感谢!它几乎是完美的,我只需要让它自己扩展,当你把浏览器窗口变大时,当我把它变小时,我需要滚动查看所有内容。现在,当我设置例如1000宽度,它可以在较小的窗口,但可怕的全屏。谢谢你的帮助!