Results 1 to 2 of 2

Thread: Insert image into a DIV tag background property

  1. #1
    Join Date
    Mar 2010
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Insert image into a DIV tag background property

    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?

    Thank you!
    Judith

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Missing nothing. What you want is the CSS, which you appear to be using.

    Code:
    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.
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •