John Smithe John Smithe - 10 days ago 6
CSS Question

Copy header style from another site

I have this sample:

link

CODE HTML:

<div class="main">
<header>
<div class="bg"></div>
</header>
</div>


CODE CSS:

.main{
width: 100%;
position: relative;
}
header{
text-align: center;
margin: 0 auto;
overflow: hidden;
position: relative;
}
.bg{
background:url(../images/hero_large.jpg);
width: 2560px;
height: 1354px;
background-size: 2560px 1354px;
background-repeat: no-repeat;
position: relative;
margin-left: -1280px;
left: 50%;
}


I want to copy the header from this link

I tried to copy this header but something goes bine.Totul CSS code is copied from there but in my example does not work.

Can you tell me please what is missing and what is not? ... I repeat there is CSS code

Thanks in advance!

Answer

So i tried Modifying the code and change the background to red and it works fine. i think the path of your image is the problem

.main{
    width: 100%;
    position: relative;
}
header{
    text-align: center;
    margin: 0 auto;
    overflow: hidden;
    position: relative;
}
.bg{
    background:red;
    width: 2560px;
    height: 1354px;
    background-size: 2560px 1354px;
    background-repeat: no-repeat;
    position: relative;
    margin-left: -1280px;
    left: 50%;
}
<div class="main">
  <header>
    <div class="bg"></div>  
  </header>  
</div>