简体   繁体   English

HTML,CSS:表格不会使我的页面相应调整大小

[英]HTML , CSS: Table doesn't make my page resize accordingly

I recently downloaded a very simple template for my website. 我最近为我的网站下载了一个非常简单的模板。
It contains 1) a simple style.css and 2) an example index.php 它包含1)一个简单的style.css和2)一个示例index.php

On my attempt to edit that index.php and add a table, on the <div class="main_body"> area, the main content (main body) area, does't resize the height of the page accordingly . 在我尝试编辑index.php并在<div class="main_body">区域添加表时,主内容(主体)区域不会相应地调整页面的高度

However, page resizes just fine with <p> , <h1> tags , etc. The problem occurs only with tables. 但是,使用<p><h1>标签等页面可以正常调整大小。只有表格才会出现问题。
Notice that i have tried to make it rezise with a couple of ways: 请注意,我试图通过几种方式进行重新调整:

  • #main .main_body {height:auto;} code in: style.css 97th line. #main .main_body {height:auto;}代码位于: style.css 第97行。
  • table #displayblocktest {display: inline-block;} code: style.css 2nd line. table #displayblocktest {display: inline-block;} code: style.css 2nd line。

I uploaded everything on http://jsfiddle.net/48dog2sj/ . 我在http://jsfiddle.net/48dog2sj/上传了所有内容。

So, my question is, what changes do i need to make in order to make my page resize accordingly to tables size ? 所以,我的问题是,为了使我的页面根据表大小调整大小,我需要做出哪些更改?
Hopefully someone knows a way around this problem. 希望有人知道解决这个问题的方法。

Lose the align=left --it's changing the default wrapping around the table: http://www.w3schools.com/tags/att_table_align.asp . 丢失align=left - 正在更改表格的默认包装: http//www.w3schools.com/tags/att_table_align.asp Furthermore, it's deprecated; 此外,它已被弃用; you should use the CSS float property instead. 你应该使用CSS float属性。

Fiddle: http://jsfiddle.net/48dog2sj/1/ 小提琴: http//jsfiddle.net/48dog2sj/1/

你必须从表元素中删除align=left

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM