2016-04-01 133 views
0

我有这样的代码,我把网页上:填充不工作填补右

function Room333(dis,www){ 
    var content = '<a id="showRtb" href="#"><div style="position: fixed;text-align:center;left: 0px;width: 250px;height: 100px;bottom: 0px;z-index: 9999999;/* background: #fff; */background-image: url(&quot;http://i.imgur.com/Q5R0btP.png&quot;) !important;"> </div></a><div id="rtb" style="width:100%; height:100%; position:fixed; padding:30px; left:0px; top:0px; z-index:99999999; display:none; background:rgba(0, 0, 0, 0.8)"><iframe src="http://www.blic.rs" style="border:0px #FFFFFF none;" name="myiFrame" scrolling="yes" frameborder="0" marginheight="0px" marginwidth="0px" height="100%" width="100%"></iframe><div id="hideRtb" style="background:#fff; cursor:pointer; top:15px; right:15px; z-index:9999999; position:fixed; border-radius:25px;"><img style="width:50px; height50px;" src="http://i.imgur.com/QqlcQwu.png"></div></div>'; 

    var newNode = document.createElement("DIV"); 
    newNode.innerHTML = content; 
    document.body.appendChild(newNode); 

    document.getElementById('showRtb').addEventListener('click', function() { 
    document.getElementById('rtb').style.display="inline-table"; 
    }); 
    document.getElementById('hideRtb').addEventListener('click', function() { 
    document.getElementById('rtb').style.display="none"; 
    }); 
} 

,并尝试等等#2如果你打电话

Room333(33,'asd'); 

你会得到左小横幅底侧,当点击然后你会看到酥料饼但是看看右填充,

为什么一切都罚款左,上,钮填充哪里是30PX,但右填充为0像素?

我该如何解决这个问题?

看吧右页边距,填充: enter image description here

+1

可以循环,即问题是(在IMG)?我不知道你在说究竟 – ochi

+0

右填充填充这是问题,becouse我写的填充:30像素,所以pading为每方... – Andrew

回答

1

你是100%的宽度和100%的高度相结合的填充。在这种情况下,默认情况下,整个宽度超过填充量的100%,这可能是您的情况。

添加

box-sizing: border-box; 

这将calulate填充内部 100%的宽度。