0

This is my sample html code

<div style="overflow-y: visible; overflow-x: scroll; width: 600px;">
  <div style="width: 230px;float:left;">Some label</div>
  <div style="width: 230px;float:left;">Some label</div>
  <div style="width: 230px;float:left;">Some label</div>
  <div style="width: 230px;float:left;">Some label</div>
  <div style="width: 230px;float:left;">Some label</div>
  <div style="width: 230px;float:left;">Some label</div>
</div>

Example here http://jsfiddle.net/jbfDU/1/

I want to show all the text in single line and scrollbar horizontally should appear. But from the example you can see the they are showing in single line but all of the text are not showing and also scrollbar is not working as expected.

1

1 Answer 1

2

Use white-space: nowrap for wrapper and display: inline-block for elements

<div style="overflow-y: hidden; overflow-x: scroll; width: 600px; height: 30px;white-space: nowrap;">
  <div style="width: 230px;display:inline-block;">Some label</div>
  <div style="width: 230px;display:inline-block;">Some label</div>
  <div style="width: 230px;display:inline-block;">Some label</div>
  <div style="width: 230px;display:inline-block;">Some label</div>
  <div style="width: 230px;display:inline-block;">Some label</div>
  <div style="width: 230px;display:inline-block;">Some label</div>
</div>

http://jsfiddle.net/jbfDU/4/

Sign up to request clarification or add additional context in comments.

Comments

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.