简体   繁体   中英

How do i make a background image right click able?

I gave up on trying to center an image vertically and horizontally. I seen solutions that require you to know the size of the image. I do know background-image will center it properly. However i cannot right click the image and hit save as. Is there a trick i can use to allow this?

No, this is not possible.
Background images are not intended to be any more than a pretty surrounding for the important parts and there is no reason why they should be easily downloadable.

You can always add an <img> in the <div> that you are setting the background for. And set the opacity to 0.

Users can't see it but they can still right click and save it.

In firefox you can view background images. Then you can save the image

Have you taken a look at this potential answer?

http://www.brunildo.org/test/img_center.html

His solution is pure HTML+CSS, doesn't require foreknowledge of the image height and works in: Opera 6+. Safari, IE5+/Win, and IE5/Mac.

Use Firebug plugin for Firefox. You can browse to the DOM element and then find the background image. Then there's an option to "open image in tab". From there saving it is simple.

I assume this is for development purposes and not something you want end users to do.

That depends on your browser -- in Firefox3, you may use Tools->Page Info->Media, locate the image from the list and hit "Save As..."

I think an HTML/CSS option is not possible, but I'm not completely sure.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM