Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/230.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/apache-kafka/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
Php 显示div时出现的问题_Php_Html_Css - Fatal编程技术网

Php 显示div时出现的问题

Php 显示div时出现的问题,php,html,css,Php,Html,Css,我已经将一个php页面(courses.php)包含到另一个php页面(courses.php)中。 在course.php中包含courses.php之后,我编写了一个div标记,希望它显示在以courses为标题的div旁边 //Courses.php <html> <head> <style> #top { height: 100px;

我已经将一个php页面(courses.php)包含到另一个php页面(courses.php)中。 在course.php中包含courses.php之后,我编写了一个div标记,希望它显示在以courses为标题的div旁边

//Courses.php

    <html>
    <head>
        <style>
            #top
            {
                height: 100px;
                border :0.5px solid;
            }
            #left
            {
                height: 520px;
                width: 250px;
                border :0.5px solid;
            }
        </style>
    </head>

    <body>
        <div id = "top"></div>
        <div id = "left">
            <center>
                <h2><b> COURSES </h2></b>
                <ul>
                    <li><a href = "Html.html" target = "output"> HTML </a> 
               </li>
                    <li><a href = "C++.html" target = "output"> C++ </a> 
                </li>
                </ul>
            </center>
        </div>
    <body>
</html> 
<style>
    #top
    {
        height: 100px;
        border :0.5px solid;
    }
    #left
    {
        height: 520px;
        width: 250px;
        border :0.5px solid;
    }
</style>

<div id = "top"></div>
<div id = "left">
    <center>
        <h2><b> COURSES </h2></b>
        <ul>
            <li><a href = "Html.html" target = "output"> HTML </a> 
       </li>
            <li><a href = "C++.html" target = "output"> C++ </a> 
        </li>
        </ul>
    </center>
</div>

#顶
{
高度:100px;
边框:0.5px实心;
}
#左
{
高度:520px;
宽度:250px;
边框:0.5px实心;
}
课程

//course.php

    <html>
    <head>
        <style>
        #center
            {

                height: 530px;
                width: 900px;
                border :0.5px solid;
            }

        </style>
    </head>
    <body>

            <?php include("courses.php");?>

            <div id = "center">
            <h2>HEY</h2>
            </div>
    </body>
    </html>

#居中
{
高度:530px;
宽度:900px;
边框:0.5px实心;
}
嘿

我想把显示HEY的div显示在显示课程的div旁边。 还建议如何将具有HEY的div标记垂直分为两个相等的部分

我试着展示两个相邻的div:

  • 在div中包含include php标记
  • 包括include php标记(在一个div中)以及 父div标记
  • 然后使用不同的 但这并没有什么帮助

  • 您可以在Courses.php中简单地这样编写

        <html>
        <head>
            <style>
                #top
                {
                    height: 100px;
                    border :0.5px solid;
                }
                #left
                {
                    height: 520px;
                    width: 250px;
                    border :0.5px solid;
                }
            </style>
        </head>
    
        <body>
            <div id = "top"></div>
            <div id = "left">
                <center>
                    <h2><b> COURSES </h2></b>
                    <ul>
                        <li><a href = "Html.html" target = "output"> HTML </a> 
                   </li>
                        <li><a href = "C++.html" target = "output"> C++ </a> 
                    </li>
                    </ul>
                </center>
            </div>
        <body>
    </html> 
    
    <style>
        #top
        {
            height: 100px;
            border :0.5px solid;
        }
        #left
        {
            height: 520px;
            width: 250px;
            border :0.5px solid;
        }
    </style>
    
    <div id = "top"></div>
    <div id = "left">
        <center>
            <h2><b> COURSES </h2></b>
            <ul>
                <li><a href = "Html.html" target = "output"> HTML </a> 
           </li>
                <li><a href = "C++.html" target = "output"> C++ </a> 
            </li>
            </ul>
        </center>
    </div>
    
    
    #顶
    {
    高度:100px;
    边框:0.5px实心;
    }
    #左
    {
    高度:520px;
    宽度:250px;
    边框:0.5px实心;
    }
    课程
    

    body元素允许包含样式,但这不是一个好的做法,建议您拆分为两个文件,Courses.php和Courses_css.php,并将它们导入Course.php中的正确位置。php

    您必须只有一个头部和身体,要完成此工作,您必须合并文件。Include不是一个好主意。请建议如何进行合并。
    标记,不应再使用。谢谢,我已经在courses.php中包含了courses.php的内联css和courses.php中的内部css,但是,当我再次尝试让div有HEY旁边的div有COURSES时,我尝试了float和position属性,但是在让两个div相邻时没有任何帮助。在此方面的任何帮助都将不胜感激。