Full Width Image - Foundation

I want parts of my web page to have a background image that extends to the entire page, with no spaces at the edges. Is it possible? Im using a base framework of 5.

HTML

  <div class="row"  id="wrapper">
    <div class="large-12  columns">
      <div class="kickstart"><img src="img/kick-start.png">
        <p class="getfit"><img src="img/get-fit.png"></p>
        <p class="home-text"> BodyMetrix Personal Training is a new company, based in South London, aiming to bring one-on-one training sessions and personalised exercise and nutrition plans. </p>
        <p class="get-contact"><img src="img/get-contact-btn.png"></p>
        </div>
        </div>
      </div>

CSS

#wrapper {
    background-image: url("../img/home-img.png");
    background-repeat: no-repeat;
    width: 100% !important;
    z-index: 0;


}
.kickstart {

    padding: 30px;
}
.getfit {
    padding-top: 10px;
}

.home-text {
    font-family: 'Open Sans', sans-serif;
    font-size: 1em;
    font-weight: normal;
    color: black;
}
+4
source share
3 answers

There are two ways to do this.

You can specify the #wrapperwidth 100%or change your HTML:

<div id="wrapper">
  <div class="row">
    <div class="large-12  columns">
      <div class="kickstart"><img src="img/kick-start.png">
        <p class="getfit"><img src="img/get-fit.png"></p>
        <p class="home-text"> BodyMetrix Personal Training is a new company, based in South London, aiming to bring one-on-one training sessions and personalised exercise and nutrition plans. </p>
        <p class="get-contact"><img src="img/get-contact-btn.png"></p>
      </div>
    </div>
  </div>
</div>

Since it divis a block element, it will default to a value width:100%. Until he is in an existing class .row, he will be 100%.

+4
source
#wrapper {
    background-image: url("../img/home-img.png");
    background-repeat: no-repeat;
    background-size: cover;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    width: 100% !important;
    z-index: 0;
}
+2
source

background-size . , .

:

#wrapper { 
  background: url("../img/home-img.png") no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  width: 100% !important;
  z-index: 0;
}
-1
source

Source: https://habr.com/ru/post/1541784/


All Articles