Avoid negative gap in box layout