删除标题和正文之间的空白区域

时间:2017-05-05 10:42:46

标签: css

我试图移除标题和正文之间的空白区域,但无法使其正常工作。我已经包含了显示我的代码的代码段。有谁知道怎么排序这个?



header {
    width: 100%;
    height: 10em;
    background-color: #345cd7;
    position: relative;
    margin: 0;
    padding: 0;
}


.top-box {
    background-color: #345cd7;
    margin: 0;
    padding: 0;
}

<body>
  <header>
    <img src="images/white.svg" id="logo" />
</header>
    <div class="top-box">
        <h1>Welcome to</h1>
        <h2>Welcome to the family. Download one of the apps and get making them calls!</h2>
    </div>
</body>
&#13;
&#13;
&#13;

5 个答案:

答案 0 :(得分:1)

只需在h1标记中设置header { width: 100%; height: 10em; background-color: #345cd7; position: relative; margin: 0; padding: 0; } .top-box { background-color: #345cd7; margin: 0; padding: 0; } .top-box h1{ margin:0; }

&#13;
&#13;
<header>
    <img src="images/white.svg" id="logo" />
</header>
<body>
    <div class="top-box">
        <h1>Welcome to</h1>
        <h2>Welcome to the family. Download one of the apps and get making them calls!</h2>
    </div>
</body>
&#13;
set_header(key, value)
&#13;
&#13;
&#13;

答案 1 :(得分:0)

将标题放在正文中:

import validate from 'mongoose-validator'

const isEmail = validate.validatorjs.isEmail

[...]
    email: {
      type: String,
      validate: {
        validator: value => isEmail(value),
        message: 'is not valid'
      }
    }
[...]

确保标题上的任何填充和边距为0

答案 2 :(得分:0)

默认情况下,

h1标记有一个边距。因此,只需删除该边距(在本例中为top)即可完成工作

&#13;
&#13;
header {
  width: 100%;
  height: 10em;
  background-color: #345cd7;
  position: relative;
  margin: 0;
  padding: 0;
}

.top-box {
  background-color: #345cd7;
  margin: 0;
  padding: 0;
}
h1 {
  margin-top: 0;
}
&#13;
<header>
  <img src="images/white.svg" id="logo" />
</header>
<div class="top-box">
  <h1>Welcome to</h1>
  <h2>Welcome to the family. Download one of the apps and get making them calls!</h2>
</div>
&#13;
&#13;
&#13;

答案 3 :(得分:0)

只需使用通用选择器即可:

*{ margin: 0%; }

来源:https://css-tricks.com/almanac/selectors/u/universal/

答案 4 :(得分:0)

beforeEach(function() { cy.server() cy.route('get', /waiting_for_response/).as('response') }) it('checks for good data', function() { cy.get('.get-data').click() cy.wait('@response', {timeout:10000}).then((xhr) => { expect(xhr.responseHeaders.data).to.not.be.a('null') }) }) 用于标题样式表。