how can I make a image not dragable on a website

Discussion in 'Apple, Inc and Tech Industry' started by natatos, Feb 28, 2009.

  1. natatos macrumors regular

    Joined:
    Dec 23, 2008
    Location:
    Iowa
    #1
    like on smosh.com they have the cardboard and the paint on it how is that not dragable if its a background how does it not repeat kind of thing
     
  2. Shadow macrumors 68000

    Shadow

    Joined:
    Feb 17, 2006
    Location:
    Keele, United Kingdom
    #2
    You need to set it as a background. For example:

    Code:
    CSS:
    .box {
       background-image: url(relative/path/to/image.jpg);
       height: 100px;
       width: 100px;
    }
    
    HTML:
    <div class="box"></div>
    
    However, this isn't a particularly "good" thing to do on the 'net, and even so if people *really* want the image they can hunt through your CSS and get it. Why do you want to do this anyway?
     
  3. Dimwhit macrumors 68000

    Dimwhit

    Joined:
    Apr 10, 2007
    #3
    Don't forget, unless you can disable the ability to take a screenshot, there's no way to protect your images. Watermarks are the best if you're really concerned about it.
     
  4. Tomorrow macrumors 604

    Tomorrow

    Joined:
    Mar 2, 2008
    Location:
    Always a day away
    #4
    In Firefox, you can right-click the cardboard background and select View Image. Then you can save it, drag it, whatever.
     
  5. natatos thread starter macrumors regular

    Joined:
    Dec 23, 2008
    Location:
    Iowa
    #5
    well its not really that I dont want people to take the pictures or anything but I want stuff like borders and other decretive stuff that are images that would be better if they weren't savable also I forgot to add I use dreamweaver CS4
     
  6. Tomorrow macrumors 604

    Tomorrow

    Joined:
    Mar 2, 2008
    Location:
    Always a day away
    #6
    This would be cumbersome, but you could make your site entirely Flash-based. Much harder to grab an image from a Flash movie than a CSS or HTML site.
     
  7. Shadow macrumors 68000

    Shadow

    Joined:
    Feb 17, 2006
    Location:
    Keele, United Kingdom
    #7
    Please, don't. Flash is terrible, and if people *really* want the image, they'll just use a SWF decompiler and get it. A good rule of thumb for anything to do with DRM is that if you can 'consume' it (like viewing an image, hearing some music, watching a video), it can be cracked.

    If you want to add borders and things like that, an inline image is probably your best bet. It would also make floats easier, like so:

    Code:
    HTML:
    <img src="relative/path/to/image.jpg" alt="Demo image" class="image" />
    
    CSS:
    div.image {
        float: left;
        border: 1px solid silver;
    }
    
    
    
     
  8. Tomorrow macrumors 604

    Tomorrow

    Joined:
    Mar 2, 2008
    Location:
    Always a day away
    #8
    Please, that's like saying "CSS is terrible." Flash is only terrible if someone uses it to program something terrible.
     
  9. Shadow macrumors 68000

    Shadow

    Joined:
    Feb 17, 2006
    Location:
    Keele, United Kingdom
    #9
    While normally I would agree with that sentiment, in this case I don't - Flash on X is actually pretty bad. See here for details.
     

Share This Page