Background image to ignore padding-top CSS

2019-09-20 18:03发布

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?

Thanks

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

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

}

CSS for h3 to have space above

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

}

1条回答
别忘想泡老子
2楼-- · 2019-09-20 18:31

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.

查看更多
登录 后发表回答