I want to use inline-block
to put two div elements side by side (just like float:left
), but when I open the page in the browser the second div goes to the next line, but when set the center div width to 79% or less. Then it displays in one line, but it seems that there is about 4px space between left and center div, then I set the margin of both div to 0px, result was the same.
If anyone knows about this please suggest me how to solve. Thank in advance.
Note: If I user float
then there is no problem, but I need to use inline-block
The code is bellow.
css:
<style type="text/css">
#container {
width: 980px;
}
#container, #left, #center {
display: inline-block;
}
#left {
width: 20%;
}
#center {
width: 80%;
}
</style>
html:
<div id="container">
<div id="left">
left other elements goes here
</div>
<div id="center">
center other elements goes here
</div>
</div>