发生了什么
我想要什么
如您所见,即使我设置了 body{padding: 0; ,
.#Demo-Card
的右侧仍有这个讨厌的空白区域边距:0;}
我也试过:
#Demo-Card {
padding: 0;
margin: 0;
}
但这没有用。
如何摆脱这个讨厌的空白区域?
如果有人可以提供帮助,我们将不胜感激!
代码
HTML
<body>
<div id="Demo-Card">
<header>
<h3><span class="problem-number">11</span> <span class="problem-equation">Problem</span></h3>
</header>
<!--<button id="Run">Run Demo</button>-->
<div class="iframe-container">
<iframe id="Demo-iFrame" src="mathsynthesis/LearningByExample/GUI/web/mathsynth.html">
<p>Your browswer does not support iFrames</p>
</iframe>
</div>
</div>
</body>
CSS
body{
padding: 0;
margin: 0;
font-family: 'Work Sans', sans-serif;
}
/*DEMO-CARD FORMATTING*/
#Demo-Card {
width: calc(100vw - 40px);
height: calc(100vh - 40px - 50px); /*40px for borders, 50px for menu*/
background-color: white;
border: 20px solid #86E1D8;
}
最佳答案
在 id 为 Demo-Card
的 div 上,你有这个 CSS 集:
宽度:计算(100vw - 40px);
相当于浏览器窗口的总宽度减去40px。
相反,将其设置为:
宽度:100%;
它应该可以工作。
关于html - 如何摆脱div右侧的空白?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38513964/