I wanted to position two divs side by side based on the size of the container div. The second div positioned below the first because there is a 4 pixel gap between them somehow. Why and more importantly what is that? Margins, padding and border is 0px to make it cleaner.
<div id='container' width='300'>
<div id='left' width='150'></div>
<div id='right' width='150'></div>
</div>
I know you can use float to achieve the goal but I want to know the cause.
Also I have noticed when I get the width() of an element I didn't get the same number what's in the debug window. Any clue?
Thanks!
Edit: OK, I see know it's a ' ' between them because of the new line character. It doesn't seems to matter if it's 'inline-block' or 'block' though. However setting the container to display as 'flex' appears to be a solution.
(Also thank you for the suggestions on how to remove the space even if there are white space characters between the divs! I still can't upvote sadly because of low reputation...)