1

I have a section containing several div...whenever horizontal scroll is present into the section, how can i shift the hidden div to next line...

HTML

<section id="a">
<div class="num">
<div class="num">
<div class="num">
<div class="num">
<div class="num">
<div class="num">
</section>

CSS

.num
{
 position: relative;  display: table-cell;
}
Venkat.R
  • 7,420
  • 5
  • 42
  • 63
ghost...
  • 975
  • 3
  • 16
  • 33

1 Answers1

1

I believe you need two things:

Media queries because you should be testing and designing based on screen size, not necessarily individual devices like you appear to be wanting to do.

word-wrap:break-word; because this will prevent a horizontal scroll appearing if one of the div elements are too long - the element's content will simply jump to the next line.

You'd find a suitable screen size by which you wish to do your nextline-shifting at and apply word-wrap:break-word; to the div.num elements inside.

Then, in your media query for larger devices, you simply wouldn't include it, and your div elements will keep to one line with a horizontal scroll if necessary.

dsgriffin
  • 66,495
  • 17
  • 137
  • 137