【问题标题】:child div not resizing with parent子 div 没有与父级一起调整大小
【发布时间】:2016-06-18 15:24:31
【问题描述】:
I have the following html structure for a template.php page in my website. 

<!DOCTYPE html>
<html lang="en">
<head>
    <title></title>
    ......
    </head>
    <body>
        <div id="container">
            <div class="header_div"> </div>
        <div>        

        <div id="body">
            <div id="nav_bar_left">
                <ul>
                    <li></li>
                </ul>
            </div>

            <div id="content_right">
                <?php $this->load->view($content); ?>
            </div>
        </div>

        <div style="clear: both"></div>

        <div class="footer"> </div>
        <div class="copyright"><p>Copyright &copy; All Rights Reserved.</p></div>
    </body>
</html>

然后我有一个load_view.php查看文件代码如下所示

<div>   
    <?php echo form_open('main_controller/form_validate'); ?>  
    <table cellspacing="10">
        <tr>
            <td> </td> 
        </tr>
        <tr>
            .....
        </tr>
            ........
    </table>
    <?php echo form_close(); ?>
    <div class="clear"></div>
</div>

加载到我的控制器中的内容区域

  function reg_pupil()
   {        
    $data['content'] = 'load_view';
    $this->load->view('template', $data);
   }

但是,当调整大小时,表单不会随其父级一起调整大小。怎么解决,有什么解决办法吗?

【问题讨论】:

  • 将渲染后的 html 与你的 CSS 一起发布,这样我们就可以看到它的样子
  • 试试这个方法 =>

标签: php html css codeigniter


【解决方案1】:

将此样式用于响应式。

<style>
@media (max-width:640px) {
table {
    display:block;
    width:100%;
    padding:0;
    margin:0 auto;
}
tbody, tr {
    display:block;
    width:100%;
}
table td {
    display:inline-block;
    float:left;
    width:100%;
}
}
</style>

【讨论】:

    猜你喜欢
    • 2020-06-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-07-14
    • 1970-01-01
    • 2013-10-19
    • 1970-01-01
    相关资源
    最近更新 更多