html - 使用 CSS 在 div 上截断文本

标签 html css

我卡住了。自从我编码 CSS 以来已经有一段时间了。我只需要知道我应该去解决这个问题的方向。现在,背景并没有在我的主包装器 div 上一直延伸到页面下方。

我试过更改几项内容,但似乎没有任何效果。我试过使用 clearfix,但似乎也没有什么不同。

如有任何帮助,我们将不胜感激!

html {
  height: 100%;
}

body {
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: #fdfdfd;
}

.wrapper {
  margin: auto;
  width: 1000px;
  min-height: 100%;
  background-color: #f5f4f0;
  overflow: hidden;
  height: 100vh;
}

.main {
  width: 1000px;
  padding-top: 14px;
  position: absolute;
  background-color: #f5f4f0;
  height: 100vh;
  float: left;
}

.clear {
  clear: both;
}

.logo {
  position: relative;
  background-color: #fcc700;
  margin: auto;
  width: 50%;
  width: 1000px;
  height: 193px;
}

.logo img {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  height: auto;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
}

.spacer1 {
  background-color: #f5f4f0;
  margin: auto;
  width: 50%;
  width: 1000px;
  height: 14px;
}

.search {
  background-color: #f5f4f0;
  margin: auto;
  width: 50%;
  width: 1000px;
  height: 108px;
}

.menu {
  background-color: #dbdbdb;
  margin: auto;
  width: 50%;
  width: 1000px;
  height: 220px;
  position: relative;
}

.menu img {
  max-height: 100%;
  max-width: 100%;
  width: auto;
  height: auto;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  margin: auto;
}

.square1 {
  background-color: #cdcdcd;
  margin: auto;
  width: 50%;
  width: 178px;
  height: 178px;
  border: 2px solid #d7d7d7;
  position: absolute;
  top: 0;
  bottom: 0;
  left: -780px;
  right: 0;
}

.square2 {
  background-color: #cdcdcd;
  margin: auto;
  width: 50%;
  width: 178px;
  height: 178px;
  border: 2px solid #d7d7d7;
  position: absolute;
  top: 0;
  bottom: 0;
  left: -390px;
  right: 0;
}

.square3 {
  background-color: #cdcdcd;
  margin: auto;
  width: 50%;
  width: 178px;
  height: 178px;
  border: 2px solid #d7d7d7;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

.square4 {
  background-color: #cdcdcd;
  margin: auto;
  width: 50%;
  width: 178px;
  height: 178px;
  border: 2px solid #d7d7d7;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 390px;
  right: 0;
}

.square5 {
  background-color: #cdcdcd;
  margin: auto;
  width: 50%;
  width: 178px;
  height: 178px;
  border: 2px solid #d7d7d7;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 780px;
  right: 0;
}

.leftcolumn {
  background-color: #FFF;
  margin: auto;
  width: 50%;
  width: 480px;
  border: 2px solid #d7d7d7;
  position: absolute;
  left: 10px;
  line-height: 1;
}

.rightcolumn {
  background-color: #FFF;
  margin: auto;
  width: 50%;
  width: 480px;
  border: 2px solid #d7d7d7;
  position: absolute;
  left: 506px;
}

#recentarticles {
  color: #bbbbbb;
  padding-top: 15px;
  padding-left: 15px;
  padding-bottom: 13px;
  position: relative;
  border-bottom: 5px solid #fcc700;
  font: 20px "Times New Roman", Serif;
  margin: 1px;
  line-height: normal;
}

#recentarticlesbody {
  color: #bbbbbb;
  padding-top: 15px;
  padding-left: 15px;
  padding-bottom: 13px;
  padding-right: 5px;
  position: relative;
  font: 20px "Times New Roman", Serif;
  margin: 1px;
  line-height: normal;
}

#recentarticlesbody h1 {
  color: #373737;
  position: relative;
  font: 26px "Times New Roman", Serif;
  margin: 1px;
}

#recentarticlesbody h2 {
  color: #818181;
  position: relative;
  font: 18px "Times New Roman", Serif;
  margin: 1px;
}

#recentarticlesbody h1 a:link,
a:visited {
  color: #373737;
  position: relative;
  font: 26px "Times New Roman", Serif;
  margin: 1px;
}

#recentarticlesbody h1 a:hover,
a:active {
  color: #bbbbbb;
  position: relative;
  font: 26px "Times New Roman", Serif;
  margin: 1px;
}

#recentarticlesbody p {
  color: #aeaeae;
  position: relative;
  font: 12px "Verdana", Serif;
  margin: 1px;
}

#hotarticles {
  color: #bbbbbb;
  padding-top: 15px;
  padding-left: 15px;
  padding-bottom: 13px;
  position: relative;
  border-bottom: 5px solid #fcc700;
  font: 20px "Times New Roman", Serif;
  margin: 1px;
}
<div class="wrapper">

  <div class="spacer1"></div>

  <div class="logo"><img src="images/logo.jpg"></div>

  <div class="search"></div>

  <div class="menu">
    <div class="square1">
      <a href=""><img src="images/vendorcontacts.jpg"></a>
    </div>
    <div class="square2">
      <a href=""><img src="images/tsdocuments.jpg"></a>
    </div>
    <div class="square3">
      <a href=""><img src="images/bookmarks.jpg"></a>
    </div>
    <div class="square4">
      <a href=""><img src="images/suggestfeat.jpg"></a>
    </div>
    <div class="square5">
      <a href=""><img src="images/news.jpg"></a>
    </div>
  </div>

  <!-- main section -->

  <div class="main">

    <div class="leftcolumn">
      <div id="recentarticles">Recent Articles</div>
      </span>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <a href="">
              <font color="000000">Maintenace Notifications</font>
            </a>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>
    </div>
    <div class="rightcolumn">
      <div id="hotarticles">Hot Articles</div>
      </span>
      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

      <div id="recentarticlesbody">
        <h1><a href="">Lorem ipsum dolor</a></h1>
        <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</p>
          <p>18 March, 2018 in
            <font color="000000">Maintenace Notifications</font>
          </p>
      </div>

    </div>


  </div>

</div>

<!-- end main section -->

</div>

Sample

最佳答案

您的 html 代码中有很多错误。我尽我所能进行了更正,并更改了您的 CSS 中的一些颜色,以便更好地查看发生了什么。尽管您可能想要进一步修改,但这看起来很有效。将来,当您遇到 html 问题时,第一个检查应该类似于 w3 标记服务 W3validator

我在您的 html 中发现的错误包括:

<h2> tags terminated with </p>
reuse of id's - should change these to class
2 stray </span> tags
1 stray </div>
<font> tag use - has been depreciated
no <head> tags, no <title> tag, no lang specified in <html> tag
no alt= on image tags

html {
      height: 100%;
    }

    body {
      height: 100%;
      margin: 0;
      padding: 0;
      background-color: blue;
    }

    .wrapper {
      margin: auto;
      width: 1000px;
      min-height: 100%;
      background-color: #f5f4f0;
      overflow: hidden;
      height: 100vh;
    }

    .main {
      width: 1000px;
      padding-top: 14px;
      position: absolute;
      background-color: #f5f4f0;
      height: 100vh;
      float: left;
    }

    .clear {
      clear: both;
    }

    .logo {
      position: relative;
      background-color: #fcc700;
      margin: auto;
      width: 50%;
      width: 1000px;
      height: 193px;
    }

    .logo img {
      max-height: 100%;
      max-width: 100%;
      width: auto;
      height: auto;
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      margin: auto;
    }

    .spacer1 {
      background-color: #f5f4f0;
      margin: auto;
      width: 50%;
      width: 1000px;
      height: 14px;
    }

    .search {
      background-color: #f5f4f0;
      margin: auto;
      width: 50%;
      width: 1000px;
      height: 108px;
    }

    .menu {
      background-color: #dbdbdb;
      margin: auto;
      width: 50%;
      width: 1000px;
      height: 220px;
      position: relative;
    }

    .menu img {
      max-height: 100%;
      max-width: 100%;
      width: auto;
      height: auto;
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
      margin: auto;
    }

    .square1 {
      background-color: #cdcdcd;
      margin: auto;
      width: 50%;
      width: 178px;
      height: 178px;
      border: 2px solid #d7d7d7;
      position: absolute;
      top: 0;
      bottom: 0;
      left: -780px;
      right: 0;
    }

    .square2 {
      background-color: #cdcdcd;
      margin: auto;
      width: 50%;
      width: 178px;
      height: 178px;
      border: 2px solid #d7d7d7;
      position: absolute;
      top: 0;
      bottom: 0;
      left: -390px;
      right: 0;
    }

    .square3 {
      background-color: #cdcdcd;
      margin: auto;
      width: 50%;
      width: 178px;
      height: 178px;
      border: 2px solid #d7d7d7;
      position: absolute;
      top: 0;
      bottom: 0;
      left: 0;
      right: 0;
    }

    .square4 {
      background-color: #cdcdcd;
      margin: auto;
      width: 50%;
      width: 178px;
      height: 178px;
      border: 2px solid #d7d7d7;
      position: absolute;
      top: 0;
      bottom: 0;
      left: 390px;
      right: 0;
    }

    .square5 {
      background-color: #cdcdcd;
      margin: auto;
      width: 50%;
      width: 178px;
      height: 178px;
      border: 2px solid #d7d7d7;
      position: absolute;
      top: 0;
      bottom: 0;
      left: 780px;
      right: 0;
    }

    .leftcolumn {
      background-color: #FFF;
      margin: auto;
      width: 50%;
      width: 480px;
      border: 2px solid #d7d7d7;
      position: absolute;
      left: 10px;
     
    }

    .rightcolumn {
      background-color: #FFF;
      margin: auto;
      width: 50%;
      width: 480px;
      border: 2px solid #d7d7d7;
      position: absolute;
      left: 506px;
    }

    #recentarticles {
      color: #bbbbbb;
      padding-top: 15px;
      padding-left: 15px;
      padding-bottom: 13px;
      position: relative;
      border-bottom: 5px solid #fcc700;
      font: 20px "Times New Roman", Serif;
      margin: 1px;
      line-height: normal;
    }

    #recentarticlesbody {
      color: #bbbbbb;
      padding-top: 15px;
      padding-left: 15px;
      padding-bottom: 13px;
      padding-right: 5px;
      position: relative;
      font: 20px "Times New Roman", Serif;
      margin: 1px;
      line-height: normal;
    }

    #recentarticlesbody h1 {
      color: #373737;
      position: relative;
      font: 26px "Times New Roman", Serif;
      margin: 1px;
    }

    #recentarticlesbody h2 {
      color: #818181;
      position: relative;
      font: 18px "Times New Roman", Serif;
      margin: 1px;
    }

    #recentarticlesbody h1 a:link,
    a:visited {
      color: #373737;
      position: relative;
      font: 26px "Times New Roman", Serif;
      margin: 1px;
    }

    #recentarticlesbody h1 a:hover,
    a:active {
      color: #bbbbbb;
      position: relative;
      font: 26px "Times New Roman", Serif;
      margin: 1px;
    }

    #recentarticlesbody p {
      color: #aeaeae;
      position: relative;
      font: 12px "Verdana", Serif;
      margin: 1px;
    }

    #hotarticles {
      color: #bbbbbb;
      padding-top: 15px;
      padding-left: 15px;
      padding-bottom: 13px;
      position: relative;
      border-bottom: 5px solid #fcc700;
      font: 20px "Times New Roman", Serif;
      margin: 1px;
      line-height: normal;
    }
<!DOCTYPE html> 
<html lang='en'>
<head><title>hi</title></head>
<body>




    <div class="wrapper">

      <div class="spacer1"></div>

      <div class="logo"><img src="images/logo.jpg" alt='nogo'></div>

      <div class="search"></div>

      <div class="menu">
        <div class="square1">
          <a href=""><img src="images/vendorcontacts.jpg" alt='nogo'></a>
        </div>
        <div class="square2">
          <a href=""><img src="images/tsdocuments.jpg" alt='nogo'></a>
        </div>
        <div class="square3">
          <a href=""><img src="images/bookmarks.jpg" alt='nogo'></a>
        </div>
        <div class="square4">
          <a href=""><img src="images/suggestfeat.jpg" alt='nogo'></a>
        </div>
        <div class="square5">
          <a href=""><img src="images/news.jpg" alt='nogo'></a>
        </div>
      </div>

      <!-- main section -->

      <div class="main">

        <div class="leftcolumn">
          <div id="recentarticles">Recent Articles</div>
          

          <div id="recentarticlesbody0">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <a href="">
                  <span style="color:pink">Maintenace Notifications</span>
                </a>
              </p>
          </div>

          <div id="recentarticlesbody1">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody2">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody3">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody4">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody5">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody6">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody7">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody8">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody9">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>
        </div>
        <div class="rightcolumn">
          <div id="hotarticles">Hot Articles</div>
          
          <div id="recentarticlesbody10">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody11">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody12">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody13">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody14">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody15">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody16">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody17">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody18">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
               <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

          <div id="recentarticlesbody19">
            <h1><a href="">Lorem ipsum dolor</a></h1>
            <h2>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer nec odio. Praesent libero. Sed cursus ante dapibus diam. Sed nisi...[]</h2>
              <p>18 March, 2018 in
                <span style="color:pink">Maintenace Notifications</span>
              </p>
          </div>

        </div>


      </div>

    </div>

    

    

</body>
</html>

关于html - 使用 CSS 在 div 上截断文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49580498/

相关文章:

javascript - 垂直滚动条根据滚动距离一点点移动

javascript - IE 和 Firefox 中的文件按钮问题

jquery - 交换图像翻转站点中心

css - block 状网格的使用及其在 Foundation5 中存在的原因

javascript - 有没有办法在 ASP.Net 页面中悬停在 html 元素上时更改它

html - 将 CSS 背景颜色应用于第 n 个 child 3 到 10 的最简单方法

html - 如何使宽度未知的元素居中?

html - CSS div布局定位

jquery - 循环中的背景图像旋转

javascript - 计算背景图像比