Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.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/3/html/89.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
Css 为什么我清除时会得到一条白线:两者都是?_Css_Html - Fatal编程技术网

Css 为什么我清除时会得到一条白线:两者都是?

Css 为什么我清除时会得到一条白线:两者都是?,css,html,Css,Html,我正试图让h1出现在左边,h2出现在右边,多亏了之前一篇关于stackoverflow的文章,我成功地做到了这一点。但是现在文本下面出现了一条白线,严重干扰了我的设计。有什么想法吗 <div id="container"> <div id="header"> <h1 style="text-align:left;float:left;">Ken DeRosier</h1> <h2 style="text-align:rig

我正试图让h1出现在左边,h2出现在右边,多亏了之前一篇关于stackoverflow的文章,我成功地做到了这一点。但是现在文本下面出现了一条白线,严重干扰了我的设计。有什么想法吗

<div id="container">
  <div id="header">
    <h1 style="text-align:left;float:left;">Ken DeRosier</h1>
    <h2 style="text-align:right;float:right;">Master Sculptor</h2> 
    <hr style="clear:both;">
    <!-- end #header -->
  </div>
  ...
</div>

我认为这是因为你使用了一个叫做“水平规则”的

。你为什么不试着用
span
div
或其他东西来清除那些不打算用可见的东西来显示自己的东西呢?

我认为这是因为你使用了

又称为“水平规则”。您为什么不尝试使用
span
div
或其他工具来清除不打算以可见内容显示的内容?

尝试替换此行

<hr style="clear:both;">

用这个

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

尝试更换此行

<hr style="clear:both;">

用这个

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


出于某种原因,CSS不想在代码视图中发布。抱歉。@Rob:您必须将代码缩进4个空格(或单击相应的工具栏按钮)才能获得代码格式。出于某种原因,CSS不想在代码视图中发布。抱歉。@Rob:您必须将代码缩进4个空格(或单击相应的工具栏按钮)才能获得代码格式。@Rob Clement:但不是使用内联样式,而是在CSS文件中定义CSS类。更易于维护和分离标记和样式。@Rob Clement:但与其使用内联样式,不如在CSS文件中定义CSS类。更易于维护和分离标记和样式。