php - include header.php css,不会在 include footer.php 或 body 上工作

标签 php html css

我正在尝试 require '_header.php';require '_footer.php'; 这样我就可以为我的站点创建一个动态主体。

但是,所有 CSS 都无法在正文或页脚中使用。 CSS 仅适用于页眉。

为什么会发生这种情况,如何解决?

require '_header.php';



$form_to_echo = '<div class="form_wrap"><form id="registration" action="new_user.php" method="post">                                                                

    <div class="i_group"><span class="s_name">Класа:</span> 
    <input type="radio" id="_rad_rnk_class_h" name="rank_class" value="H"'.$_frm_selected_rank_class_h.'><label for="_rad_rnk_class_h">Хоби</label>
    <input type="radio" id="_rad_rnk_class_t" name="rank_class" value="T"'.$_frm_selected_rank_class_t.'><label for="_rad_rnk_class_t">Трофеј</label>
    </div>

    <input type="text" id="cell_phone" name="cell_number" placeholder="Мобилен телефон" value="'.$_POST['cell_number'].'">
    </div>  

    <div class="i_group"><span class="s_name">Крвна група:</span><br><br>                               
    <input type="radio" id="_rad_bld_typ_a" name="blood_type" value="A"'.$_frm_selected_bld_typ_a.'><label for="_rad_bld_typ_a">A</label>
    <input type="radio" id="_rad_bld_typ_b" name="blood_type" value="B"'.$_frm_selected_bld_typ_b.'><label for="_rad_bld_typ_b">B</label>
    <input type="radio" id="_rad_bld_typ_ab" name="blood_type" value="AB"'.$_frm_selected_bld_typ_ab.'><label for="_rad_bld_typ_ab">AB</label>
    <input type="radio" id="_rad_bld_typ_o" name="blood_type" value="O"'.$_frm_selected_bld_typ_o.'><label for="_rad_bld_typ_o">O</label>
    </div>                                      
    <div class="i_group">               
    <input type="submit" name="submit" class="submit" value="Pегистрирај">
    </div></form></div>';


if ($error_count_up != 0) { 

    echo $form_to_echo; 

}

require '_footer.php';  

当我将代码复制并粘贴到 HTML 中时,它工作得很好...


<!DOCTYPE html>
<html>


    <head lang="mk">
        <meta charset="utf-8">


        <link rel="stylesheet" type="text/css" href="style.css">


        <link rel="stylesheet" type="text/css" href="./css/font-awesome.min.css">

        <title>;</title>
        <style type="text/css">

</style>



               <script src="//ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 
               <!--<script src="script.js"></script> -->


                 <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
                  <script src="//code.jquery.com/jquery-1.12.4.js"></script>
                  <script src="//code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
                  <script>
                        $( function() {
                            $( "#datepicker" ).datepicker({
                                changeMonth: true,
                                changeYear: true
                            });
                        $( "#datepicker" ).datepicker( "option", "dateFormat", "dd-mm-yy" );
                        } );
                  </script>

    </head>





    <body>      



        <div id="showcase">


            <div id="sw_img1"></div>
            <div class="img_fade"></div>

                <div class="main_wrapper">

                    <div id="logo"></div>


                    <ul id="top_nav">

                        <li>Правилник</li>

                        <li>Контакт</li>    

                    </ul>


                </div>

        </div>

        <div class="test1">test</div>






    </body>





</html>

最佳答案

尝试使用包含... PHP: include

关于php - include header.php css,不会在 include footer.php 或 body 上工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39667323/

相关文章:

php - Dreamhost 上的 uploadify/php 导致大型 http 上传失败

javascript - 如何使用jQuery获得 parent parent child 的值(value)?

css - 调整大小时保持 p 元素附加到 h2 p 元素不移动

javascript - 如何计算实际的 innerWidth/innerHeight?

javascript - Material design Lite - 导航锁定到位

ios - iPad 上的 CSS 灵活框布局

html - 如何在不使用 CSS word-break 属性的情况下停止文本跑出屏幕并破坏布局?

PHP 和 SQL : fetch_assoc/while loop goes infinite when displaying data

php - Apache 和 Terminal 在 Mac OS 10.8 上运行 2 个不同的 php 构建

php - 使用 ajax 自动更新 .txt