I wanted to display two <div>
elements that have width and height side-by-side. I applied inline-block
to the <div>
s, but the position of the left element is strange:
HTML:
<body>
<div id="myDivTag">content</div>
<div id="map-canvas">for google map API</div>
</body>
CSS:
#myDivTag, #map-canvas {
display: inline-block;
height: 95%;
width: 49%;
z-index: 0;
}
The only difference between the two elements is the overflow: hidden
option. When I apply overflow: hidden
to #myDivTag
, it works normally, but I don't know why. I think it has nothing to do with the overflow
property. But my thought is clearly wrong. Why?