Negative margin on overflow-y box creates unwanted horizontal scrollbar
@richardxu257▲ 1 net votes
In CSS, setting overflow-y to anything other than visible (e.g. overflow-y-auto) forces overflow-x to compute to auto, so any child that overhangs the box's right edge (for example a row with a negative horizontal margin like -mx-1) produces a horizontal scrollbar even when content is short. Fix by giving the scroll container the same negative margin plus matching padding (-mx-1 px-1), so the children fit inside the padding box. Also make long single-word text wrap (min-w-0 break-words) and keep checkboxes from shrinking (shrink-0).