内容重叠div

Dot*_*nnn 3 html css overlapping

我有重叠内容的问题.当我为HTML编写此代码时,content_left中的文本与我希望它包含的整个区域重叠.当我将高度更改为自动时,它无法解决问题.内容重叠到右侧,底部被切断.

#wrapper {
  height: 1500px;
  margin: 20px auto auto auto;
  padding: 0;
  background: url(wrapper.png);
}

.content_left {
  float: left;
  width: 600px;
  padding: 20px 0 0 30px;
  margin-left: -300px;
  position: relative;
  height: auto;
}
Run Code Online (Sandbox Code Playgroud)
<div id="wrapper">

  <div id="header">

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

    <div id="header_right">
    </div>
  </div>
  <div class="content_left">
    hfhfhfhfhfhfhfhfhfhfhffhfhhfhfhfhfhfhfhfhfhfhfhffhfh hfhfhfhfhfhfhfhfhfhfhffhfhhfhfhfhfhfhfhfhfhfhfhffhfh hfhfhfhfhfhfhfhfhfhfhffhfhhfhfhfhfhfhfhfhfhfhfhffhfh hfhfhfhfhfhfhfhfhfhfhffhfhhfhfhfhfhfhfhfhfhfhfhffhfh hfhfhfhfhfhfhfhfhfhfhffhfhhfhfhfhfhfhfhfhfhfhfhffhfh
    hfhfhfhfhfhfhfhfhfhfhffhfhhfhfhfhfhfhfhfhfhfhfhffhfh hfhfhfhfhfhfhfhfhfhfhffhfhhfhfhfhfhfhfhfhfhfhfhffhfh hfhfhfhfhfhfhfhfhfhfhffhfhhfhfhfhfhfhfhfhfhfhfhffhfh hfhfhfhfhfhfhfhfhfhfhffhfhhfhfhfhfhfhfhfhfhfhfhffhfh hfhfhfhfhfhfhfhfhfhfhffhfhhfhfhfhfhfhfhfhfhfhfhffhfh
    hfhfhfhfhfhfhfhfhfhfhffhfhhfhfhfhfhfhfhfhfhfhfhffhfh hfhfhfhfhfhfhfhfhfhfhffhfhhfhfhfhfhfhfhfhfhfhfhffhfh
  </div>

  <div class="content_right">
  </div>

  <div class="footer">
    Footer goes here
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

示例jsfiddle示例

Nul*_*teя 5

因为字符串(单词)中没有空格尝试

 .content_left{overflow:hidden;}
Run Code Online (Sandbox Code Playgroud)

我不认为任何有效的字符串(单词)和你一样长


Gab*_*oli 5

看到小提琴,我可以发表的评论是

  • height:700px;从中删除#wrapper
  • 添加overflow:hidden#wrapper
  • 添加 ((由于您的文本太长而无法容纳在一行中word-wrap: break-word;,所以这将启用分词功能。.content_left

可以在http://jsfiddle.net/gaby/L6acE/1/上看到结果


可以在http://caniuse.com/#search=word-wrap上看到对该功能的支持。