0

I have created a list. Here is my code

<!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>

here is the output (yellow color is highlighted afterward).

enter image description here

here some contents with footer are hidden.

I want to fix the footer paragraph at yellow highlighted position.

tao
  • 82,996
  • 16
  • 114
  • 150
sikka karma
  • 115
  • 1
  • 12

2 Answers2

1

I guess you want to add an overflow-y: hidden to your list & let the footer show up afterwards.

.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>
GuCier
  • 6,919
  • 1
  • 29
  • 36
  • no , I don`t want a scroll bar. it should be just fixed at bottom. – sikka karma Mar 27 '18 at 05:19
  • All right here you go then, I didn't catch what you first asked! You then just have to hide the overflow of the UL list, not the entire container. I edited the snippet. – GuCier Mar 27 '18 at 11:01
0

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)

enter image description here

sikka karma
  • 115
  • 1
  • 12