Setting Infinite Width on an element – HTML


The maximum width we can add on a div is 100%. What if you want more than that ? The solution is not to add more percentage to div but to do something other. Adding white-space property.
This will only work on the main parent elements such as elements with display property as follows:

  1. block
  2. table
  3. inline-block

So now you know what are the main parent elements. Now back to the point, to add infinite width set the white-space property to the value nowrap. Example:

div{
 white-space:nowrap;
}

and put display:inline-block on all the children elements.
Now the div will get an infinite width. Enjoy !!!