Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/github/3.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
Css 根据div大小对齐表格_Css_Html - Fatal编程技术网

Css 根据div大小对齐表格

Css 根据div大小对齐表格,css,html,Css,Html,我把桌子放在房间里,若我改变窗户的尺寸,桌子就会从房间里出来。请帮帮我。提前谢谢。下面是我的代码 <div style="height:auto"> <table width="100%" style="width: 100%;"> <thead> <tr > <th width="16.5%">sunday</th> <th width="16.5%">monday</th>

我把桌子放在房间里,若我改变窗户的尺寸,桌子就会从房间里出来。请帮帮我。提前谢谢。下面是我的代码

<div style="height:auto">
 <table  width="100%" style="width: 100%;">
<thead>
  <tr >
    <th  width="16.5%">sunday</th>
    <th width="16.5%">monday</th>
    <th width="16.5%">tuesday</th>
    <th width="16.5%">wed</th>
    <th width="16.5%">thu</th>
    <th width="16.5%">fri</th>
  </tr>
</thead>
<tbody>
  <tr  >
    <td>111</td>
    <td ><input value="" type="" name="" /></td>
    <td ><input value="" type="" name="" /></td>
    <td ><input value="" type="" name="" /></td>
    <td ><input value="" type="" name="" /></td>
    <td ><input value="" type="" name="" /></td>
  </tr>
</tbody>
</table>
     </div>

星期日
星期一
星期二
结婚
清华大学
星期五
111

如果希望div包含表,可以使用
溢出:auto
。这使得div可以滚动


但是,如果不希望它是可滚动的,请改用
display:table

如果希望div包含该表,可以使用
overflow:auto
。这使得div可以滚动

但如果您不希望它是可滚动的,请使用
display:table

将此添加到CSS中:

td input {
    width: 90%;
    margin: 0 auto;
}
在CSS中添加以下内容:

td input {
    width: 90%;
    margin: 0 auto;
}

在代码中添加以下
css

div{
    width: 500px; /* you can apply any width to this div */
}

table{
    table-layout:fixed;
    border-spacing: 0;
    border-collapse: separate;
}
table td{
    padding: 5px;
}

input{
    width: 100%;
    box-sizing: border-box;
}

选中此项

在代码中添加以下
css

div{
    width: 500px; /* you can apply any width to this div */
}

table{
    table-layout:fixed;
    border-spacing: 0;
    border-collapse: separate;
}
table td{
    padding: 5px;
}

input{
    width: 100%;
    box-sizing: border-box;
}

选中此项

您必须以百分比形式指定文本字段大小 移除固定宽度的表格标题

CSS

HTML


星期日
星期一
星期二
结婚
清华大学
星期五
111

工作小提琴

您必须以百分比形式指定文本字段大小 移除固定宽度的表格标题

CSS

HTML


星期日
星期一
星期二
结婚
清华大学
星期五
111

工作小提琴

您应该将div样式设置为
显示:内联块


您还应该使用外部css文件,而不是内联样式MORGE更改某些内容时的效率。

您应该将div样式设置为
display:inline block


您还应该使用外部css文件,而不是内联样式很多当你改变某事时效率更高。

谢谢你,纳亚娜·亚当斯里亚谢谢你,纳亚娜·亚当斯里亚