忽略padding-top CSS的背景图片 [英] Background image to ignore padding-top CSS

查看:221
本文介绍了忽略padding-top CSS的背景图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的网站的第一部分有背景图片,但该部分有填充顶部,以便从导航栏中分隔第一个标题。有没有办法可以让背景图像超过顶部填充?

I have a background-image on the first section of my site however there is padding-top on that section in order to seperate the first title from the navbar. Is there a way I can get the background image to over ride the top padding?

谢谢

HTML

<nav>

        <a href="#getting-his-start"><b>Getting his Start</b></a>&nbsp;&nbsp;
        <a href="#cinematic-revolution"><b>Cinematic Revolution</b></a>&nbsp;&nbsp;
        <a href="#experimental-phase"><b>The Experimental Phase</b></a>&nbsp;&nbsp;
        <a href="#logos-made-to-last"><b>Logos Made to Last</b></a>&nbsp;&nbsp;
        <a href="#the-nect-big-thing"><b>The Next Big Thing</b></a>&nbsp;&nbsp;
        <a href="#his-influence-today"><b>His Influence Today</b></a>&nbsp;&nbsp;

    </nav>

    <section class="start">

        <h2 id="getting-his-start">Getting his Start</h2>

CSS for background image

CSS for background image

.start {
background-image: url(../images/goldenarmamend.png);
background-position: top right;
height: 100%vh;
width: 100%vw;

}

h3要有的CSS上面的空格

CSS for h3 to have space above

h3 {
font-size: 1.5em;
margin-top: 3em;
margin-bottom: 0.7em;
text-transform: uppercase;

}

推荐答案

添加margin-top而不是padding-top并将标题向上移动,带有负边距top。
如果您可以在该部分共享代码段,则可以给出确切的答案。

Add a margin-top instead of padding-top and move the title up with negative margin top. IF you can share code snippet on that section can give a exact answer.

这篇关于忽略padding-top CSS的背景图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆