Why Is My Background Image Not Covering the Full Section?

Background image not covering full section problems usually happen when background-size:cover is missing, the section has no height, the background is applied to the wrong element, or a shorthand rule resets the background size.

Background Image Fix

Why is my background image not covering the full section?

A background image not covering full section can leave blank space, repeat as a tiny tile, stop halfway down the hero, or only cover the content area instead of the whole section. The fix usually comes down to four things: the section needs real height, the image needs background-size:cover, the background must be on the right element, and later CSS must not reset your background settings.

  • background-size
  • section height
  • background-position
  • mobile hero

What the bug looks like

The image repeats, leaves blank space, covers only the top, does not reach the bottom, or only covers a small inner block.

Why it happens

A background image covers the element it is applied to, not the section you imagined in the design.

What usually fixes it

Apply the background to the real section, give the section height, and use background-size:cover with safe position and repeat values.

Error 1

background-size:cover is missing

By default, a background image does not automatically stretch to cover the section. If the image is smaller than the section, it can repeat. If it is a different ratio, it may leave empty space unless you tell it how to fit.

Broken code

Natural size / repeat
.hero {
  background-image: url(hero.jpg);
  background-position: center;
}

Broken visual result

Image does not fill section
not covered
Hero section The background uses its natural size instead of covering the section.
The browser needs a sizing instruction. A background image does not automatically become a cover image.

Correct code

Cover the section
.hero {
  background-image: url(hero.jpg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

Fixed visual result

Image fills the section
covered
Hero section The image covers the full section without tiling.
cover fills the section, while no-repeat prevents tiling.
Error 2

The section has no real height

A background image only paints inside the element’s box. If the section has little content and no height or padding, the background may technically cover the section, but the section itself is too short.

Broken code

Short section
.hero {
  background-image: url(hero.jpg);
  background-size: cover;
  background-position: center;
}

Broken visual result

Background covers only a tiny area
section too short
Hero The element itself has little height.
The image may be covering the element correctly, but the element is not tall enough.

Correct code

Give section height
.hero {
  min-height: 70vh;
  padding: 96px 24px;
  background-image: url(hero.jpg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

Fixed visual result

Section has a real area
full section
Hero section The section has enough height for the background to cover.
Use min-height and padding to create the section area the image should cover.
Error 3

The background is applied to the wrong element

A common layout mistake is applying the background to an inner content wrapper instead of the full section. The image then covers only the wrapper, not the whole hero or section area.

Broken code

Background on inner wrapper
.hero {
  min-height: 70vh;
}

.hero-content {
  background-image: url(hero.jpg);
  background-size: cover;
}

Broken visual result

Only the inner block is covered
wrong element
Inner wrapper The background is not on the outer section.
A background only covers the element it is attached to.

Correct code

Background on section
.hero {
  min-height: 70vh;
  background-image: url(hero.jpg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.hero-content {
  max-width: 720px;
}

Fixed visual result

The full section is covered
right element
Hero section The outer section owns the background.
Put the background on the element whose full area needs to be painted.
Error 4

A later background shorthand resets your cover settings

The background shorthand can reset multiple background properties. If you set background-size:cover first, then later use background:, your cover setting can disappear.

Broken code

Shorthand reset
.hero {
  background-image: url(hero.jpg);
  background-size: cover;
}

.hero.is-dark {
  background: linear-gradient(rgba(0,0,0,.5), rgba(0,0,0,.5)), url(hero.jpg);
}

Broken visual result

Cover got reset
reset
Hero section A later background shorthand changed the result.
A later shorthand can remove the cover behavior you thought was still active.

Correct code

Keep size after shorthand
.hero.is-dark {
  background:
    linear-gradient(rgba(0,0,0,.5), rgba(0,0,0,.5)),
    url(hero.jpg);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

Fixed visual result

Cover restored
cover kept
Hero section The shorthand and cover settings work together.
After a background: shorthand, set background-size, position, and repeat again.
Premium pattern

A production-minded full-section background pattern

A reliable hero background pattern puts the image on the real section, creates a real section area, uses a layered overlay, and repeats the important background rules in one place.

Premium code

Full-section hero background
.hero {
  min-height: min(760px, 82vh);
  padding: clamp(72px, 10vw, 140px) 24px;
  display: grid;
  place-items: center;
  color: white;

  background:
    linear-gradient(rgba(15, 23, 42, .58), rgba(15, 23, 42, .58)),
    url("hero.jpg");
  background-size: cover;
  background-position: var(--hero-position, center);
  background-repeat: no-repeat;
}

@media (max-width: 640px) {
  .hero {
    min-height: 70vh;
    background-position: var(--hero-position-mobile, center);
  }
}

Premium visual result

Background covers the full section
premium
Premium hero Full-section background, overlay, height, and focal point all work together.
Premium background CSS does not guess. It defines the section size, image fit, overlay, and mobile position clearly.

Fast practical rule

If a background image is not covering the full section, inspect the section box first. Then set background-size:cover, background-position:center, background-repeat:no-repeat, and make sure no later background: shorthand resets those values.

Debug checklist

  • Inspect the section and confirm it has the height and width you expect.
  • Make sure the background image is applied to the outer section, not only an inner wrapper.
  • Set background-size:cover when the image should fill the whole section.
  • Set background-repeat:no-repeat to avoid tiling.
  • Use background-position to control the focal point.
  • Check whether a later background: shorthand reset your size, repeat, or position.
  • Avoid background-size:contain when the goal is full-section coverage.
  • Use mobile-specific background positions when the subject shifts on narrow screens.
Best first move Add a temporary border to the section. If the border is short, the section is short.
Most common cause background-size:cover is missing or got reset by a later shorthand.
Most sneaky cause The background is on the content wrapper, not the full-width section.
Better mindset Background images cover element boxes. Fix the box before blaming the image.

Final takeaway

A background image not covering full section is usually not an image problem. It is usually a section sizing, background sizing, wrong element, or CSS reset problem.

Put the background on the real section, give that section enough height, use background-size:cover, prevent repeat, and keep your background shorthand from resetting the important rules.

Want more fixes like this?

Browse more background image, responsive layout, and CSS debugging guides in the FrontFixer library.