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 8465623
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:06:14+00:00 2026-06-10T15:06:14+00:00

For a site, I need to be able to dynamically display background images depending

  • 0

For a site, I need to be able to dynamically display background images depending on the user’s screen resolution.

I.e when the page starts loading, within the <head> a small javascript loads, which sets the page’s background via css to something like http://example.com/backgrounds/beach_800x600 where 800 and 600 is the screen resolution determined via the javascript.

I’m creating various resized images for the most common screen resolutions, so that for most people there will be an exact match of their screen resolution with an existing image. If there’s not an exact match made, e.g if a user has a screen resolution AxB for which there’s no existing image, then an image will be created & resized to AxB on the fly, and will be served. From then on, anyone with the resolution AxB would be served that image.

The questions I have are:

1) Is this a safe method? I.e I don’t want more than 50 custom sized images created for custom screen resolutions. Would I be able to stay in that ball park with this method? And are there any other security risks I should be aware of with this method?

2) Should I give it an error margin of say 50 or 100 pixels, so if someone’s resolution is 700×900, and I don’t have that but I have 600×800 or I have 800×1000, then I would serve those existing images rather than create new ones? If so, should I set the margin at 100 pixels or is there a better number?

  • 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-10T15:06:15+00:00Added an answer on June 10, 2026 at 3:06 pm

    Through the use of CSS3 Media Queries and the background-size property, there’s virtually no need for JS other than for compatibility purposes with out-dated browsers.

    Here’s a link with details about background-size. This property allows you to scale the image in various ways, regardless of the users resolution. Sometimes this might not be ideal.

    And so we have CSS3 Media Queries. With these, you can target certain resolutions (or greater than and less than certain resolutions) and tell the browser which image you would like to show accordingly (or even how to display it, with or without background-size as well).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a site where I need to be able to split
I need to be able to read xml/rss from a https web site in
In my site.master, i need to be able to rewrite the current route to
On my site I need to request a date/time every page reload. The reason
I'm building a site and need to allow users to be able to create
I need to be able to login to a site via Forms Authentication using
I need to be able to download some file from a regular site using
I need to be able to programmatically find the PageRank of a site from
I need to be able to remove the description text within search results which
I have a site that need to know if the user have other pages/tabs

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.