Full-screen responsive background image

0 votes

I'm new to front-end development and the Foundation framework.

I'm attempting to make the div class="main-header"> a full-screen image that scales down responsively.

Could someone please tell me what I'm doing wrong? It is scaling properly, but it is not displaying the entire image. Is it possible to have the div class="large-6 large-offset-6 columns"> sit above it on a mobile device?

HTML code:

<!-- MAIN HEADER -->
<div class="main-header">
   <div class="row">
     <div class="large-6 large-offset-6 columns">
       <h1 class="logo">BleepBleeps</h1>
       <h3>A family of little friends<br>that make parenting easier</h3>
     </div> <!-- END large-6 large-offset-6 columns -->
   </div><!-- END ROW -->
</div><!-- END MAIN-HEADER -->

The CSS:

.main-header {
    background-image: url(../img/bb-background2.png);
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    width: 100%;
    height: 100%;
}

h1.logo {
    text-indent: -9999px;
    height:115px;
    margin-top: 10%;
}
Aug 4, 2022 in HTML by Abhinaya
• 1,160 points
1,818 views

1 answer to this question.

0 votes
img.bg {
  /* Set rules to fill background */
  min-height: 100%;
  min-width: 1024px;

  /* Set up proportionate scaling */
  width: 100%;
  height: auto;

  /* Set up positioning */
  position: fixed;
  top: 0;
  left: 0;
}

@media screen and (max-width: 1024px) { /* Specific to this particular image */
  img.bg {
    left: 50%;
    margin-left: -512px;   /* 50% */
  }
}


try this

answered Aug 4, 2022 by Deepak
• 980 points

Related Questions In HTML

0 votes
1 answer

How do I give text or an image a transparent background using CSS?

In order to ensure that your image ...READ MORE

answered Feb 8, 2022 in HTML by Rahul
• 9,690 points
1,625 views
0 votes
0 answers
<