在固定维度div内溢出属性隐藏段落,如何在固定位置显示?

How to display a paragraph at a fixed position if it is hidden due to overflow property inside a fixed dimension div?

我已经创建了一个列表。这是我的代码

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" />
  <title>testing overflow</title>
  <style>
    .DivofList{height:300px;width:20%;border:solid thick black; overflow:hidden;}
  </style>
</head>
<body>
  <div class="container">
    <div class="row">
      <div class="DivofList">
        <h3 style="background-color:darkorange">pumaList</h3>
        <ul class="list-group">
          <li class="list-group-item"><a href="#">content</a></li>
          <li class="list-group-item"><a href="#">content1</a></li>
          <li class="list-group-item"><a href="#">content2</a></li>
          <li class="list-group-item"><a href="#">content3</a></li>
          <li class="list-group-item"><a href="#">content4</a></li>
          <li class="list-group-item"><a href="#">content5</a></li>
          <li class="list-group-item"><a href="#">content6</a></li>
          <li class="list-group-item"><a href="#">content7</a></li>
          <li class="list-group-item"><a href="#">content8</a></li>
          <li class="list-group-item"><a href="#">content9</a></li>
      </ul>
        <footer>
          <a href="#" style="color:red;">more</a>
        </footer>
      </div>
    </div>

  </div>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
</body>
</html>

这是输出(之后黄色突出显示)。

这里隐藏了一些带页脚的内容。

我想在黄色突出显示的位置修复页脚段落。

我猜您想在列表中添加一个 overflow-y: hidden 并让页脚随后显示。

.DivofList{
  width:200px;
  border:solid thick black;
}

ul {
  height:300px;
  overflow: hidden;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>

<div class="container">
  <div class="row">
    <div class="DivofList">
      <h3 style="background-color:darkorange">pumaList</h3>
      <ul class="list-group">
        <li class="list-group-item"><a href="#">content</a></li>
        <li class="list-group-item"><a href="#">content1</a></li>
        <li class="list-group-item"><a href="#">content2</a></li>
        <li class="list-group-item"><a href="#">content3</a></li>
        <li class="list-group-item"><a href="#">content4</a></li>
        <li class="list-group-item"><a href="#">content5</a></li>
        <li class="list-group-item"><a href="#">content6</a></li>
        <li class="list-group-item"><a href="#">content7</a></li>
        <li class="list-group-item"><a href="#">content8</a></li>
        <li class="list-group-item"><a href="#">content9</a></li>
    </ul>
      <footer>
        <a href="#" style="color:red;">more</a>
      </footer>
    </div>
  </div>

</div>

After adding two more div. Now it is solved.

 <!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" type="text/css" media="screen" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" />
  <title>testing overflow</title>
  <style>
    .parentofList {
      height: 400px;
      width: 20%;
      border: solid thick black;
    }

    .DivofList {
      max-height:85%;
      overflow: scroll;
    }
  </style>
</head>
<body>
  <div class="container">
    <div class="row">
      <div class="parentofList">
        <h3 style="background-color:darkorange;margin:0px;">pumaList</h3>
        <div class="DivofList">

          <ul class="list-group">
            <li class="list-group-item"><a href="#">content</a></li>
            <li class="list-group-item"><a href="#">content1</a></li>
            <li class="list-group-item"><a href="#">content2</a></li>
            <li class="list-group-item"><a href="#">content3</a></li>
            <li class="list-group-item"><a href="#">content4</a></li>
            <li class="list-group-item"><a href="#">content5</a></li>
            <li class="list-group-item"><a href="#">content6</a></li>
            <li class="list-group-item"><a href="#">content7</a></li>
            <li class="list-group-item"><a href="#">content8</a></li>
            <li class="list-group-item"><a href="#">content9</a></li>
          </ul>

        </div>
        <div>
          <footer>
            <a href="#" style="color:red;margin-left:140px;">more</a>
          </footer>
        </div>
      </div>
    </div>

  </div>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
</body>
</html>

here is the solved output

it is working with or without scrollbar(overflow:hidden OR overflow:scroll)