HTML底部不需要的填充

时间:2017-08-02 07:57:19

标签: html

我创建了一个页面,但是无法摆脱文本底部添加的额外空间。这会创建一个我不想要的垂直滚动和空白区域。页面需要适合像素的像素。

Space below the text, creating a vertical scroll bar and white space below

我尝试过stackoverflow和互联网的各种解决方案,但没有任何东西可以占用空间。

<body>
<div style="line-height: 20%; position: absolute; top: 163px; left: 728px; width: 100px;">
<span id="current_weather" style="letter-spacing: -0.1em; font-size:53px;"></span><span style="letter-spacing: -0.1em; font-size:53px;">&deg;C</span>
</div>  
</body>

如果我没有以正确的格式发布问题,我表示歉意

2 个答案:

答案 0 :(得分:0)

你是否在CSS中试过这个:

*,html,body{
    margin: 0;
    padding: 0;
}

另外,如果您发布了代码段或jsFiddle,我们会更方便地帮助您。考虑这样做,我会看看并帮助您实现目标。希望这有帮助!

编辑 - 使用jsFiddle更新

这是固定版本:

https://jsfiddle.net/m0qLrk50/8/

希望这有帮助!

答案 1 :(得分:0)

您应该尝试在样式表中添加一些重置。例如:

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address,
big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl,
dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside,
canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary,
time, mark, audio, video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  vertical-align: baseline;
}

article, aside, details, figcaption, figure, footer, header, hgroup, menu, 
nav, section { display: block; }
body { line-height: 1; }
ol, ul { list-style: none; }

table {
  border-collapse: collapse;
  border-spacing: 0;
} 

body { -webkit-text-size-adjust: none; }

*, :before, :after {
  -moz-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}

如果这不起作用,请分享整个代码

相关问题