I have a bunch of li elements in a UL element that go across the width of the page. They are perfectly sized, where each element is the same 16.666667%. They fit perfect.
But when I get rid of “float:left”, and do “float:none”, they have to drop one element down a line. I can’t tell why. They are inline-block. If I change the percentage to 16.4%, they all go across the same line again.
How can I have it not drop the element to next line, as should fit the same as when float:left.
Well that explains it there.
Inline blocks and inline elements create a white-space node when they are formatted on a new line in the HTML source code.
That node adds to the overall width which is why you had to reduce your width to 16.4
You can use flexbox or display:table to eliminate the whites-pace nodes.
Change the display:table-cell to float left and then test in IE or edge and you will see the red background show at the right edge as the window is resized unlike the table-cell version.
Indeed using the table-layout:fixed algorithm you don;t have to work out the width needed.
So my temporary solution was to do “font-size:0px;” in the parent element and that fixed the issue.
I will try the Flex, though I’m working in Wordpress with WPBakery that has the pre-built classes for responsive columns so working to get custom classes to work with the column classes built-in.