Skip to content

Latest commit

 

History

History
33 lines (22 loc) · 1.06 KB

overflow_as_a_phenomenon.md

File metadata and controls

33 lines (22 loc) · 1.06 KB

According to the CSS basic box model, an element's width and height are applied to its content box. Padding falls outside of that content box and increases the element's overall size.

As a result, if you set an element with padding to 100% width, its padding will make it wider than 100% of its containing element. In your context, inputs become wider than their parent.

One can change the way the box model treats padding and width; set the box-sizing CSS property to border-box to prevent padding from affecting an element's width or height; with some HTML elemtns that may be done automatically. In my case I needed to do that for an element, but not for a element.

So, either we give to an item:

box-sizing: border-box;

We may need to add:

word-break: break-word;

In some cases, giving the following to an item's container might help:

/* First, ensure that there is no "min-width" */
width: auto;

or

display: flex;

I had a case where I some overflowing text in a table floated outside its area in mobile.