Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/83.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,为什么我的灰色div只显示一半?这是我的代码:- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <body> <div style="margin-top: 10px;font-family: helvetica,sans-serif;colo

为什么我的灰色div只显示一半?这是我的代码:-

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<body>
<div style="margin-top: 10px;font-family: helvetica,sans-serif;color: white;background: #212121;" class="round"  >
    <center>
        <h4 style="font-family: Verdana;font-style: italic;">Alumni Activities</h4>
    </center>
    <div style="margin-left: 10px;">
        <p>

            The institution has an alumni association that performs various activities to disseminate knowledge among  students regarding Education, Technology, Trends and Industry. Apart from this, it organizes technical competitions for students to effectively develop their competitive skills and arranges alumni programs that promote effective networks amongst its members.</p>
        <p>
            Events organized by Alumni Association of  are as given below:</p>
        <table align="left" border="1" cellpadding="0" cellspacing="0">
                <tr>
                    <td valign="top" width="40">
                        <p>

                            1.</p>
                    </td>
                    <td valign="top" width="363">
                        <p>
                            <strong>Event Name: </strong>Alumni Meet 2010</p>
                        <p>
                            <strong>Date of Event: </strong> 27-Feb-2010</p>

                        <p>
                            <strong>Purpose: </strong> Annual General Meeting and Get together</p>
                        <p>
                            <strong>Number of Alumni Present: </strong> 75</p>
                    </td>
                </tr>

                <tr>
                    <td valign="top" width="40">
                        <p>
                            2</p>
                    </td>
                    <td valign="top" width="363">
                        <p>
                            <strong>Event Name: </strong> Expert Talk</p>

                        <p>
                            <strong>Name of the Alumni: </strong> Mr. Nachiket Patel, Essar Ltd.</p>
                        <p>
                            <strong>Date of Event: </strong> 22-Sep-2009</p>
                        <p>
                            <strong>Purpose: </strong> To enhance the knowledge of students</p>

                    </td>
                </tr>

        </table>
        <p>
            &nbsp;</p>        </div>
</div>
</div>

校友活动

该机构有一个校友会,开展各种活动,向学生传播有关教育、技术、趋势和行业的知识。除此之外,它还为学生组织技术竞赛,以有效发展他们的竞争技能,并安排校友计划,促进其成员之间的有效网络

香港大学校友会举办的活动如下:

一,

活动名称:校友会2010

活动日期:2010年2月27日

目的:年度股东大会和聚会

出席校友人数:75

二,

活动名称:专家讲座

校友姓名:纳奇克·帕特尔先生,埃萨有限公司

活动日期:2009年9月22日

目的:提高学生的知识


在我看来,这就像是由浮动元素创建的经典“折叠父级”问题。在您的例子中,是表上的
align=left
属性

删除此属性是最简单的解决方案,否则有四种CSS解决方案,尽管主要的两种解决方案之一适用于您:

在主div中添加css
overflow:hidden
,或者在主div中添加一个清晰的浮动,例如

本文解释了该理论和其他两种可能的解决方案:


在我看来,这就像是由浮动元素创建的经典“折叠父级”问题。在您的例子中,是表上的
align=left
属性

删除此属性是最简单的解决方案,否则有四种CSS解决方案,尽管主要的两种解决方案之一适用于您:

在主div中添加css
overflow:hidden
,或者在主div中添加一个清晰的浮动,例如

本文解释了该理论和其他两种可能的解决方案:


我可以知道轮班吗?我认为div是浮动的。当您使用float div时,您需要“clear:both”div来清除float元素,这样另一个标记就不会也浮动。

我可以知道round类吗?我认为div是浮动的。当您使用float div时,您需要“clear:both”div来清除float元素,这样另一个标记就不会也浮动。

首先,您要指定的是过渡DTD级别,它是最高级别,并且要求除了格式良好的文档之外,您只使用HTML元素,以便该级别可以接受,第二,您有一个已关闭但未打开的div,第三,删除表的align=“left”属性:

<div style="margin-top: 10px;font-family: helvetica,sans-serif;color: white; background:#212121;"  
       <center>
       <h4 style="font-family: Verdana;font-style: italic;">Title</h4>
       </center>
    <div style="margin-left: 10px; " > 

     <table border="1" cellpadding="0" cellspacing="0">
      <tr><td/>Cell Content</td></tr>
     </table>
</div>

首先,您指定的是过渡DTD级别,该级别是最高级别,要求除了格式良好的文档之外,您只使用HTML元素,并且该级别接受HTML元素;其次,您有一个关闭但未打开的div,第三,删除align=“left”表格的属性:

<div style="margin-top: 10px;font-family: helvetica,sans-serif;color: white; background:#212121;"  
       <center>
       <h4 style="font-family: Verdana;font-style: italic;">Title</h4>
       </center>
    <div style="margin-left: 10px; " > 

     <table border="1" cellpadding="0" cellspacing="0">
      <tr><td/>Cell Content</td></tr>
     </table>
</div>

问题出在表标记中的凌乱
align=“left”
属性中。请参阅正常版本:

问题出在表标记中的凌乱
align=“left”
属性中。请参阅正常版本:

验证您的代码-@Jason McCreary:-我验证了,它显示的错误是由ckeditor造成的。这个表代码是由ckeditor生成的,我只是简单地将它粘贴到新的html页面中,然后发布到这里;)要么您确实验证了标记,但在SO问题中粘贴了无效的标记,要么您没有验证标记,并说您验证了。实际上,您似乎在末尾有一个额外的div,并且还没有关闭body和html标记。这是你的代码的准确副本吗?你能在JSFIDLE中发布代码并在那里做一个演示吗?这样我们就可以很容易地解决这个问题验证你的代码-@Jason McCreary:-我做了,它显示的错误是由ckeditor引起的。这个表代码是由ckeditor生成的,我只是简单地将它粘贴到新的html页面中,然后发布到这里;)要么您确实验证了标记,但在SO问题中粘贴了无效的标记,要么您没有验证标记,并说您验证了。实际上,您似乎在末尾有一个额外的div,并且还没有关闭body和html标记。这是您的代码的准确副本吗?您能在JSFIDLE中发布代码并在那里进行演示,以便我们可以轻松地解决问题吗