0

I have these html markup

    <div class="chatbar">
        <div class="chatbox" style="margin-right:0px"> first</div>
        <div class="chatbox" style="margin-right:5px"> chatbox</div>
        <div class="chatbox" style="margin-right:10px"> chatbox</div>
        <div class="chatbox" style="margin-right:15px"> chatbox</div>
             <div class="chatbox" style="margin-right:20px"> chatbox</div>
              <div class="chatbox" style="margin-right:25px"> chatbox</div>


    </div>

I want to have the chatbar div with horizontal scrollbar .. but its not working and here is my css

  .chatbox{
 float:right;

   height: 180px;
 width: 250px;
 margin-right:10px;
border-right:1px solid red;
border-left:1px solid red;
}

.chatbar {
border: 1px solid blue;
  overflow-x:scroll;
overflow-y:hidden;
width: 980px;
height: 200px;
position: relative;
bottom:10px;

 float:right;//

}

Elements are appending over each others.Hope to find solution for that.

1 Answer 1

1

Try adding a 'position:relative' into your .chatbox CSS?

    .chatbar { width:200px; overflow-x:auto; overflow-y:hidden; } 
    .wrapper { width: 600px; } 
    .chatbox { width:100px; float:left; } 

    <div class="chatbar"> 
        <div class="wrapper"> 
            <div class="chatbox"> first</div> 
            <div class="chatbox"> chatbox</div> 
            <div class="chatbox"> chatbox</div> 
            <div class="chatbox" > chatbox</div> 
            <div class="chatbox" > chatbox</div> 
            <div class="chatbox" > chatbox</div>  
       </div> 
   </div>
Sign up to request clarification or add additional context in comments.

6 Comments

What happens if you take the float off of .chatbox?
If I did that all chatbox divs are accumulated on one div .
hmmm, have you tried using 'display:inline-block' on either element? I'm looking into it now.
Okay, I think I have something of some use...you'll need to play around with dimensions as necessary but take a look at my edited answer above ^^
It's not working as expected ,,as some chatbox div are down the other ones
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.