Log in

View Full Version : Insert image into a DIV tag background property



redsky
03-17-2010, 09:59 AM
Hi,

I use DW and wonder if there are any shortcuts for inserting an image into a DIV tag background property, i.e. [I<div class="contentdiv" style="background: url(../product_bracelets/2008_450xthumbs_bracelets/001b_black.jpg) center left no-repeat">].

The DW shortcut of drag and drop, or insert img, creates the [I<img src:.../image.jpg>], which doesn't seem to work for background:url. If I type out as is, and I'm working from my hard drive, there is no image for live preview as the path is for my web site root. What am I missing here? :confused:

Thank you!
Judith

BLiZZaRD
03-17-2010, 06:27 PM
Missing nothing. What you want is the CSS, which you appear to be using.



background: url('/path/to/image.jpg') center left no-repeat;


Personally I would use an external CSS file instead of coding the CSS styles into the lines of HTMl code, but that's preference.

If you want to test it, either upload a test image and a test page, or use the location of an image on your hard drive, just changing it after you upload.