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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:39:50+00:00 2026-05-15T23:39:50+00:00

When you have two rules like this: .foo { background-image: url(foo.gif); } .foo {

  • 0

When you have two rules like this:

.foo {
  background-image: url(foo.gif);
}

.foo {
  background-image: url(bar.gif);
}

and have <div class='foo'>Foobar</div>

Will your browser cache both, or just the one actually getting displayed (bar.gif in this case)?

Is this true in all setups? (the rules being in different files, !important being applied to one, etc)

  • 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-15T23:39:50+00:00Added an answer on May 15, 2026 at 11:39 pm

    I assume by “cache” here, you mean “preload”. Actual “caching” has to do with expires headers and the like.

    It’s entirely based on the browser’s behavior and what it chooses to do. However, my experience is that modern browsers don’t bother to load an image defined in a CSS file unless the image is actually called for.

    This is one reason that some choose to make both the default and hover state of an element into one image, and then use the background-position property to change which is visible. There’s a bit more overhead, but there is also no delay between hover and the hover state being displayed, making for a smoother experience.

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

Sidebar

Related Questions

I have two CSS rules following each other: .some td:first-child:before { content:url('path/to/image.png') ; }
I have a class template Foo<T> . I'd like to implement a non-member function
I have a model with validation rule like this public function rules() { return
I have a site with two RESTful URL schemes: foo.com/model/id and foo.com/model/id/action The actual
I have a dirty URL like this: http://www.netairspace.com/photos/photo.php?photo=3392 . I want to do something
I have two classes (MVC view model) which inherits from one abstract base class.
Lets say i have two inline functions in my header file: inline int foo()
I have this rewrite rule that turns foo.com/test (or foo.com/test/) into foo.com/test.txt: RewriteRule ^test/?$
I have a bunch of name/email fields in my form like this: data[Friend][0][name] data[Friend][1][name]
I'm investigating on how validates_presence_of actually works. Suppose I have two models class Project

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.