Backgrounds for
different articles
(scroll to see effect)

This page is an example of how to set the background for a particular article. Click on the buttons at the top right or scroll the page to see the effect

Here's the HTML Code


<section id="section1">
<header id="header1"><div class="headerText">Header 1</div></header>
<div class="downArrowBox">
<div class="downArrow">&#10148;</div>
</div>
<article id="article1">
<div class="centeringDiv">
<p>Article 1</p>
</div>
<div class="clearFloats"></div>
</article>
</section>
<section id="section2">
<header id="header2"><div class="headerText">Header 2</div></header>
<div class="downArrowBox">
<div class="downArrow">&#10148;</div>
</div>
<article id="article2">
<div class="centeringDiv">
<p>Article 2</p>
</div>
<div class="clearFloats"></div>
</article>
</section>
<section id="section3">
<header id="header3"><div class="headerText">Header 3</div></header>
<div class="downArrowBox">
<div class="downArrow">&#10148;</div>
</div>
<article id="article3">
<div class="centeringDiv">
<p>Article 3</p>
</div>
<div class="clearFloats"></div>
</article>
</section>
<section id="section4">
<header id="header4"><div class="headerText">Header 4</div></header>
<div class="downArrowBox">
<div class="downArrow">&#10148;</div>
</div>
<article id="article4">
<div class="centeringDiv">
<p>Article 4</p>
</div>
<div class="clearFloats"></div>
</article>
</section>
<section id="section5">
<header id="header5"><div class="headerText">Header 5</div></header>
<div class="downArrowBox">
<div class="downArrow">&#10148;</div>
</div>
<article id="article5">
<div class="centeringDiv">
<p>Article 5</p>
</div>
<div class="clearFloats"></div>
</article>
</section>
Header 2

Here's CSS Code


header, section, article, aside, figure, figcaption, nav, footer {
display:block;
}
section {
width: 100%;
background-size: cover;/*This makes the image proportionally resize itself to cover the width of the screen*/
background-origin: content-box;/*VERY IMPORTANT - this sets where the background begins to be visible*/
background-attachment: fixed;/*VERY IMPORTANT - this makes the image NOT scroll with the content*/
background-repeat: no-repeat;/*Not needed if your image is tall enough*/
}
#section1 {
background-image: url(../images/backgrounds/bg1.jpg);/*Path relative to CSS file, not relative to html file*/
}
#section2 {
background-image: url(../images/backgrounds/bg2.jpg);
}
#section3 {
background-image: url(../images/backgrounds/bg3.jpg);
}
#section4 {
background-image: url(../images/backgrounds/bg4.jpg);
}
#section5 {
background-image: url(../images/backgrounds/bg5.jpg);
}
header {
height: calc(100vh - 120px);
padding-top: 10px;
font-size: 6em;
width: 100%;
z-index: 300;
position: relative;
color: #FFF;
display: -webkit-flex;
display: flex;
justify-content: center;
align-content: center;
}
.headerText {
margin: auto;
border: 3px #FFFFFF solid;
text-align: center;
padding: 20px;
background-color: rgba(255,255,255,0.46);
}
article {
background-color: #FFF;
height: auto;
width: 100%;
position: relative;
z-index: 300;
margin-bottom: 50px;
clear: both;
}
.downArrowBox {
background-color: #000;
width: 100px;
height: 100px;
border-radius: 50%;
margin: 0px auto 10px auto;
position: relative;
display: -webkit-flex;
display: flex;
justify-content: center;
align-content: center;
-ms-transform: rotate(90deg); /* IE 9 */
-webkit-transform: rotate(90deg); /* Chrome, Safari, Opera */
transform: rotate(90deg);
font-size:3em;
color:rgba(255,255,255,1.00);
border:2px #fff solid;
}
.downArrow {
margin: auto;
}
.centeringDiv {
padding:10px;
width: 960px;
min-height:300px;
height: auto;/*Allows this area to be vertically ELASTIC*/
margin: 0 auto;/*This centers the content on the browser*/
position: relative;
z-index: 200;
}
.clearFloats {
width: 100%;
clear: both;
height: 0;
position: relative;
}
Header 3

NO jQuery Code Needed

Article 3

Article 3

Article 3

Article 3

Article 3

Article 3

Article 3

Article 3

Article 3

Article 3

Article 3

Header 4
This is a floated content box

Article 4

Article 4

Article 4

Article 4

Article 4

Article 4

Article 4

Article 4

Article 4

Article 4

Article 4

Article 4

Article 4

Article 4

Article 4

Article 4

Article 4

Header 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5

Article 5