Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8137357
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:05:30+00:00 2026-06-06T11:05:30+00:00

I want to create a web page background image that fills the entire background,

  • 0

I want to create a web page background image that fills the entire background, without distorting the image and changing it’s proportions.

You can see a great implementation of this on LaunchRock’s pages, and on their homepage, for example.

I saw this question on StackOverflow however if you play around with what that produces you’ll see that the background image is 100% height and 100% width which means that the original proportions of the photo are not maintained and the image is stretched.

Notice in the LaunchRock example that if you resize your browser window the image grows proportionally and always fills the entire window (no matter what size window or background image they use).

If the browser window is not wide enough it crops the sides of the background image (keeping the image centered and cropping the left and right sides) and if the window is not high enough it crops the bottom part of the background image.

No matter what size the browser window is, the image height/width ratio is maintained and the entire background is filled.

I’m guess this can’t be done with pure CSS, some JavaScript may be needed.
Any ideas?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T11:05:31+00:00Added an answer on June 6, 2026 at 11:05 am

    It is done with CSS only, like this:

    body {    
        background: black url(/images/back.jpg) no-repeat top center fixed;
        -webkit-background-size: cover;
        background-size: cover;
    }
    

    Things that make it possible:

    • CSS property background-size set to cover and its vendor prefixed versions
    • using a background-image that fades to black on the sides
    • position set to top center
    • using the fixed property
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a web page with a transparent image that appears overtop
I want to create a web page that has two links. One that downloads
I want to create a photo browser web widget that can be embedded in
I want to create a web page where a registered user picks a number
I want to create a web app that lets me create, store and display
I want to create a web service in ASP.NET that fetches data from a
I want to create a web application that allows users to sign up, register
I want to create a webpage where a background image is there and on
I create a web page to control my TV (See the figure below). When
What I want to do is to create a web page for every user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.