父DIV内的2 DIVS

时间:2017-01-14 10:29:28

标签: html css

这是我的代码:

<div id ="game">
    <div id = "prodClick">
    Prod/Click:
    <div id="test">

    </div>
    </div>
        <div id = "image">
    <image src="assets/ressources.png" usemap="#upgrade" class = "mainImage"></image>   
    <map name="upgrade">
      <area shape="circle" style="display:block;" coords="98,46,22" href="/login/game/upgrade/boisClick.php">
      <area shape="circle" style="display:block;" coords="390,38,22" href="/login/game/upgrade/boisClick.php">
      <area shape="circle" style="display:block;" coords="98,436,22" href="/login/game/upgrade/boisClick.php">
      <area shape="circle" style="display:block;" coords="395,436,22" href="/login/game/upgrade/boisClick.php">
      <area shape="circle" style="display:block;" coords="208,185,22" href="/login/game/upgrade/boisClick.php">
      <area shape="circle" style="display:block;" coords="322,183,22" href="/login/game/upgrade/boisClick.php">
      <area shape="circle" style="display:block;" coords="208,305,22" href="/login/game/upgrade/boisClick.php">
      <area shape="circle" style="display:block;" coords="322,303,22" href="/login/game/upgrade/boisClick.php">
    </map>
    </div>
    <div id = "info">
    Prod/Heure
    </div>
</div>
<div id="end">

</div>

因此game div的宽度为1000px,高度为500pxProdClick div的宽度为250px,高度为500pximage div的宽度为500px,高度为500px。 ...

问题是prodClick被正确放置但是它用一种边距填充了宽度的其余部分 然后我有image div而不是prodClick div的右边,因为它被边缘填充

Image

任何解决方案对不起我的英语我是法国人

1 个答案:

答案 0 :(得分:1)

CSS

#prodClick, #image{
    display: inline-block; // get rid off unnecessary margin
}

顺便说一句,你的英语是 parfait !的: - )