If the width is just right, the close box will end up on the next line. The "li" element needs white-space: nowrap