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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:00:22+00:00 2026-05-29T04:00:22+00:00

How do you specify browser-specific fallbacks for css properties in jquery? E.g. I want

  • 0

How do you specify browser-specific fallbacks for css properties in jquery?

E.g. I want to do the equivalent of

h1 {
  background-image: -webkit-linear-gradient(left, white, black);
  background-image: -moz-linear-gradient(left, white, black);
  background-image: -o-linear-gradient(left, white, black);
  background-image: -ms-linear-gradient(left, white, black);
}
  • $('h1').css({'background-image': x, 'background-image': y}) — js syntax of course will allow only one ‘background-image’ key.
  • $('h1').css('background-image', x).css('background-image', y) — jquery will overwrite the first value.
  • $('h1').css('background-image', x + ',' + y) — browser doesn’t like it.
  • 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-29T04:00:22+00:00Added an answer on May 29, 2026 at 4:00 am

    You can ask the browser which prefix it wants by applying your CSS to an element and then reading back the value – $('h1').css('background-image'); You can then use the returned value to know what prefix to use when you set the background-image later.

    Better yet, you could take advantage of jQuery’s CSS hooks to normalize all calls to .css. There’s a great set of hooks here; you’re probably interested in the gradients hook.

    Once the hook is installed, it’s as easy as:

    $(selector).css('background-image','linear-gradient(x,y,z)');
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a number of headings and in the background of each I want
When you specify font sizes in "em" units, the browser calculates the pixel values
I want to capture Intents with a specific Uri pattern that uses the http
When writing an ASP.NET website, Visual Studio allows me to specify which browser to
I want to apply styles ( edit:in my browser's user-defined stylesheet, a local file
does anyone know how to specify the height of a net.rim.device.api.browser.field2.BrowserField? I cannot find
Browser : IE6/IE7. I want to load a new document into my html modal
1) a) Even if inside CSS file we don’t specify a margin property for
I am wanting to use jQuery to add the current browser window dimensions to
In IE8, if you use Developer Tools, you can specify your Browser Mode and

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.