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

  • Home
  • SEARCH
  • 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 7690331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:22:15+00:00 2026-05-31T20:22:15+00:00

Is there a way, without javascript, to load a small image for a background

  • 0

Is there a way, without javascript, to load a small image for a background before the real image is downloaded? Without javascript because I know how to do it with it.

I can’t test if the following CSS3 would work because it works too quick:

body { 
  background-image:url('hugefile.jpg'), url('tinypreload.jpg');
}

If the tinypreload.jpg is only, say 20k, and the hugefile.jpg is 300k — would this accomplish the task? I assume that both downloads would start at the same time instead of being consecutive.

Update

Timing the results using Firefox’s profiling revealed that it’s not practical / not worth it to load a smaller background first. Main reason is the connection time. For tiny pictures it’s the same time to connect as it is to download the content. For images where this becomes worth it — the file size is not recommended for mobile.

If you still want to achieve this effect – combine all your “necessary” images into 1 file and display them as cropped background with correct offset. Load your high-res images through javascript, and update the content afterward.

  • 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-05-31T20:22:17+00:00Added an answer on May 31, 2026 at 8:22 pm

    You could exploit css load order and overrides to achieve this result.

    Try loading the small image from your main css file and then put a <style></style> tag at the bottom of the html page. The inline style will override the main style but will load last because of it’s position in the code.

    The difference would be milliseconds though, so it may be too quick. It’s also hacky and would result in invalid, but working code. Worth a shot though.

    If you’re trying to fix a mobile problem then have a look at this article on context specific images as that might be a more effective way to go.

    This article on CSS3 multiple backgrounds may also help, as you may be able to exploit the stacking order to achieve the result you’re after

    It would be useful to know what problem you are trying to solve beyond load order, as it’s hard to give advice on this one.

    As I said in my comment you can use the ‘net’ tab in firebug for firefox (called timeline in chrome) to see the actual load order on your page – you can even filter it (on firefox) for CSS only or images only – this will enable you to test.

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

Sidebar

Related Questions

Is there any way to load some text from another file into javascript, without
Is there any way to follow a URL in JavaScript without setting the document.location.href
Is there a way to play video on a webpage with javascript without Flash
Without using Javascript, is there a way to make a CSS property toggle on
Is there any way to load a new different page without user interaction when
Is there a way (without installing any libraries) of validating XML using a custom
Is there a way to use the HAVING clause in some other way without
Is there a Python way without using a subprocess to clone a git repository?
Is there an easy way (without downloading any plugins) to connect to a MySQL
Is there a way to hide table rows without affecting the overall table width?

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.