Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.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,我正在尝试使用HTML和CSS创建证书,但由于某些原因,我无法更改表的宽度…尽管我已设置了表的宽度,但表的宽度仍然没有更改,正如上图中所示,表的宽度保持不变 我的代码: <!Doctype> <html> <head> <style> <meta name="viewport"content="width=device-width, initial-scale=1"> <

我正在尝试使用HTML和CSS创建证书,但由于某些原因,我无法更改表的宽度…尽管我已设置了表的宽度,但表的宽度仍然没有更改,正如上图中所示,表的宽度保持不变

我的代码:

<!Doctype>
<html>

<head>
  <style>
    <meta name="viewport"content="width=device-width, initial-scale=1">
    <style>
    .container {
      position: relative;
      text-align: center;
      color: white;
    }

    .l1 {
      position: absolute;
      top: 100px;
      left: 400px;
    }

    .l2 {
      position: absolute;
      top: 100px;
      left: 850px;
    }

    .l3 {
      position: absolute;
      top: 10px;
      left: 270px;
    }
    
      .OC{
      position: absolute;
      top: 40%;
      left: 50%;
      transform: translate(-50%, -50%);
    }

    .centered {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
    }
    
     .table {
      position: absolute;
      top: 83%;
      left: 50%;
      transform: translate(-50%, -50%);
      width: 100px;
    }
    
    
    
    table, th, td {
  border: 1px solid black;
  border-collapse: collapse;
  width: 100px;
  
}
th, td {
  padding: 5px;
  text-align: left;    
}

  </style>
</head>

<body>

  <div class="container">
    <img src="l3.jpg" height="800" width="800" class="l3" alt="img3" />
    <img src="l1.jpg" style="align:left" width="100" height="100" class="l1" alt="img1" />
    
    
    
    <img src="l2.png" style="align:right" width="100" height="100" class="l2" alt="img2" /><br/><br/><br/>
    
    <div class="OC">OCCUPANCY CERTIFICATE</div>

    <div class="centered" style="color: lightblue">This is to certify that the building described herein has been inspected and confirms substantially to the approved drawings & to the requirements of all the applicable codes, laws, rules and regulations that were in place at the time of the issue of this certificate.</div>
 
  
  
  <div class="table">
  <table class="table">

  <tr>
    <th>Name of Owner</th>
    <th>Plot Number</th>
    <th colspan="2">Location</th>
  </tr>
  
  <tr>
   <th>Building Type</th>
    <th>Thram Number</th>
    <th colspan="2">Designated </th>
  </tr>
  
    <tr>
   <th>Flat Type</th>
    <th>Plot  Area</th>
    <th colspan="2">Plot Coverage</th>
  </tr>
  
    <tr>
   <th rowspan="2" colspan="2">Number of Floors</th>
    <th rowspan="2">No. of Units</th>
    <th>Residential </th>
    
  </tr>
  
      <tr> 
    <th>Commercial</th>
  </tr>
  
   <tr>
   <th rowspan="2" colspan="2">Date of final Inspection</th>
    <th rowspan="2">Floor Area</th>
    <th>Residential area</th>
    
  </tr>
  
     <tr> 
    <th>Commercial area</th>
  </tr>
  
   
     <tr> 
    <th colspan="4">Remarks (if any):</th>
  </tr>
  
  
</table>

</div>

</div>

</body>

</html>

.集装箱{
位置:相对位置;
文本对齐:居中;
颜色:白色;
}
.l1{
位置:绝对位置;
顶部:100px;
左:400px;
}
.l2{
位置:绝对位置;
顶部:100px;
左:850像素;
}
.l3{
位置:绝对位置;
顶部:10px;
左:270px;
}
.OC{
位置:绝对位置;
最高:40%;
左:50%;
转换:翻译(-50%,-50%);
}
.居中{
位置:绝对位置;
最高:50%;
左:50%;
转换:翻译(-50%,-50%);
}
.桌子{
位置:绝对位置;
最高:83%;
左:50%;
转换:翻译(-50%,-50%);
宽度:100px;
}
表,th,td{
边框:1px纯黑;
边界塌陷:塌陷;
宽度:100px;
}
th,td{
填充物:5px;
文本对齐:左对齐;
}



入住证 兹证明,本证书所述建筑物已进行检查,并基本符合批准图纸和本证书颁发时所有适用规范、法律、规则和条例的要求。 业主名称 图号 位置 建筑类型 色拉数 指定的 平板式 地块面积 地块覆盖率 楼层数 单位数目 住宅的 商业的 最终检验日期 建筑面积 居住区 商业区 备注(如有):
您无法更改表格宽度,因为父div.table具有宽度:100px更改它,您的表格宽度将更改

.table {
  position: absolute;
  top: 83%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
}

您嵌套了
标记,这是错误的<代码>标记不应在
标记内。@Sansui,请添加一个可行的示例。