Background image to ignore padding-top CSS

…衆ロ難τιáo~ 提交于 2019-12-13 10:16:45

问题


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:


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.



来源:https://stackoverflow.com/questions/48077688/background-image-to-ignore-padding-top-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!