title: How to fix the scroll at the bottom?
body: <p>I am developing a Messaging system.I need Scroll bar to be fixed down ,Because when new data arrives It should automatically go down.How to do that in HTML/CSS
  Don't mine if  this full code is in a unprofessional way..</p>
  
  <p><a href="https://i.stack.imgur.com/FJhFJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FJhFJ.png" alt="enter image description here"></a></p>
  
  <p>Home.php</p>
  
  <pre><code>&lt;?php
  // Turn off all error reporting
  error_reporting(0);
      //shop not login  users from entering 
      if(isset($_SESSION['id'])){
          $user_id = $_SESSION['id'];
      }else{
  
      }
  
  
  require_once("./inc/connect.inc.php");
  ?&gt;
  
  &lt;header&gt;
      &lt;link rel="stylesheet" href="home - Copy.css" /&gt;
          &lt;nav&gt;
              &lt;h3&gt;&lt;a class="h3" href="#"&gt;CP&lt;/a&gt;&lt;/h3&gt;
              &lt;div&gt;&lt;a href="logout.php"&gt;&lt;span&gt;Logout&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;        
                          &lt;?php
  
     //Start your session
     session_start();
     //Read your session (if it is set)
     if (isset($_SESSION['user_login'])){
  
   echo '&lt;div id="ull"&gt;'.strtoupper($_SESSION['user_login']).'&lt;/div&gt;';
           }
  
  
  
         ?&gt;
  
                      &lt;/div&gt;
  
  
  
  
  
  
          &lt;/nav&gt;
          &lt;body&gt;
          &lt;div class="shead"&gt;
          &lt;div class="a1"&gt;       &lt;li   &gt;Frequent Member&lt;/li&gt;
          &lt;div class="fm"&gt;
               &lt;ul&gt;
                  &lt;?php
  
                      //show all the users expect me
                  $user_id = $_SESSION['id'];
                      $q = mysql_query("SELECT * FROM `users` WHERE id!='$user_id'");
                      //display all the results
                      while($row = mysql_fetch_assoc($q)){
                          echo "  &lt;div class='usernames'&gt;
  
  
  
                          &lt;a id=\"usernames\" href='home.php?id={$row['id']}'&gt;{$row['username']}&lt;/a&gt;
                                  &lt;/div&gt; 
                          ";
                      }
                  ?&gt;
              &lt;/ul&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
  
  
  
      &lt;div class="a2"&gt;      &lt;li &gt;Site's Popular in Your College&lt;/li&gt;&lt;/div&gt;
  
          &lt;/div&gt;
  &lt;/header&gt;
  
  
  &lt;div class="rss"&gt;
  
    &lt;?php
  
   // include('rssclass.php');
    //include('rss.php');
  
  ?&gt; 
  &lt;/div&gt;
  
  &lt;div class="message-right"&gt;
              &lt;!-- display message --&gt;
              &lt;div class="display-message"&gt;
              &lt;?php
                  //check $_GET['id'] is set
                  if(isset($_GET['id'])){
                      $user_two = trim(mysql_real_escape_string( $_GET['id']));
                      //check $user_two is valid
                      $q = mysql_query( "SELECT `id` FROM `users` WHERE id='$user_two' AND id!='$user_id'");
                      //valid $user_two
                      if(mysql_num_rows($q) == 1){
                          //check $user_id and $user_two has conversation or not if no start one
                          $conver = mysql_query( "SELECT * FROM  conversation WHERE (user_one='$user_id' AND user_two='$user_two') OR (user_one='$user_two' AND user_two='$user_id')");
  
                          //they have a conversation
                          if(mysql_num_rows($conver) == 1){
                              //fetch the converstaion id
                              $fetch = mysql_fetch_assoc($conver);
                              $conversation_id = $fetch['id'];
                          }else{ //they do not have a conversation
                              //start a new converstaion and fetch its id
                              $q = mysql_query( "INSERT INTO `conversation` VALUES ('','$user_id',$user_two)");
                              $conversation_id = mysql_insert_id($con);
                          }
                      }else{
                          die("Invalid $_GET ID.");
                      }
                  }else {
                      die("Click On the Person to start Chating.");
                  }
              ?&gt;
  
  
              &lt;/div&gt;
              &lt;script type="text/javascript"&gt;
              var objDiv = document.getElementById("display-message");
  objDiv.scrollTop = objDiv.scrollHeight;
  &lt;/script&gt;
  
  &lt;div class="send-message"&gt;
                  &lt;!-- store conversation_id, user_from, user_to so that we can send send this values to post_message_ajax.php --&gt;
                  &lt;input type="hidden" id="conversation_id" value="&lt;?php echo base64_encode($conversation_id); ?&gt;"&gt;
                  &lt;input type="hidden" id="user_form" value="&lt;?php echo base64_encode($user_id); ?&gt;"&gt;
                  &lt;input type="hidden" id="user_to" value="&lt;?php echo base64_encode($user_two); ?&gt;"&gt;
                  &lt;div class="textbox"&gt;
                      &lt;input class="t_box" type="text" id="message"  placeholder="Enter Your Message"/&gt;
                      &lt;button class="t_btn" id="reply"&gt;Reply&lt;/button&gt; 
  
                  &lt;span id="error"&gt;&lt;/span&gt;
                  &lt;/div&gt;
  
              &lt;/div&gt;
              &lt;/div&gt;
  
              &lt;!--
  &lt;div class="textbox"&gt;
      &lt;form action="#" method="post"&gt;
  &lt;input type="text" name="msg_body" class="t_box" id="t_box" &gt;
      &lt;input type="submit" class="t_btn" id="t_btn" name="submit" value="Send"&gt;
  &lt;/form&gt;
          &lt;/div&gt;--&gt;
  
  
  
  &lt;script type="text/javascript" src="js/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/script.js"&gt;&lt;/script&gt; 
  
  
  
  
  &lt;/body&gt;
  </code></pre>
  
  <p>Getmsg.php</p>
  
  <pre><code> &lt;?php
  require_once("./inc/connect.inc.php");
  if(isset($_GET['c_id'])){
      //get the conversation id and
      $conversation_id = base64_decode($_GET['c_id']);
      //fetch all the messages of $user_id(loggedin user) and $user_two from their conversation
      $q = mysql_query( "SELECT * FROM `messages` WHERE conversation_id='$conversation_id'");
      //check their are any messages
      if(mysql_num_rows($q) &gt; 0){
          while ($m = mysql_fetch_assoc($q)) {
              //format the message and display it to the user
              $user_form = $m['user_from'];
              $user_to = $m['user_to'];
              $message = $m['message'];
  
              //get name and image of $user_form from `user` table
              $user = mysql_query( "SELECT username FROM `users` WHERE id='$user_form'");
              $user_fetch = mysql_fetch_assoc($user);
              $user_form_username = $user_fetch['username'];
  
  
              //display the message
              echo "
                          &lt;div class='message'&gt;
  
                              &lt;div class='text-con'&gt;
                                  &lt;a href='#''&gt;{$user_form_username}:&lt;/a&gt;
                                 &lt;p&gt; {$message}&lt;p&gt;
                              &lt;/div&gt;
                          &lt;/div&gt;
                          &lt;hr&gt;";
  
  
          }
      }else{
          echo "No Messages";
      }
  }
  </code></pre>
  
  <p>?> </p>