Inserting An Image

Discussion in 'CSS' started by gobbly2100, Aug 16, 2007.

  1. #1
    How do I simply insert an image? I know how I would do it as a background but if I want to put an image in the CSS is there a way of doing it that is the right way for just putting an image in?
     
    gobbly2100, Aug 16, 2007 IP
  2. themasterplan

    themasterplan Peon

    Messages:
    83
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You can have it as a list-item also (that is something you should put on your css file).
    But if you just want to put a simple image, for instance beside a text, you need to put the image on your xhtml file, and you can change the way it displays from your css file. Let's say you need it on the right, and you want the text to be on the left, well, you can code that (the position) in your css using classes or maybe an id for that image or just saying how you would like all your images to display.
     
    themasterplan, Aug 16, 2007 IP
  3. soulscratch

    soulscratch Well-Known Member

    Messages:
    964
    Likes Received:
    45
    Best Answers:
    0
    Trophy Points:
    155
    #3
    Depends.

    Is it a part of the content? Is it just graphics that don't mean anything?

    If it's an image of a person you're writing an article about, the it's content, and you use the <img> element. If it's simply graphics, decoration, glitter, then set it as a background image on an element.
     
    soulscratch, Aug 16, 2007 IP
  4. Dan Schulz

    Dan Schulz Peon

    Messages:
    6,032
    Likes Received:
    436
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Soulscratch hit the nail right on the head. If the image is part of the content (like a profile picture for example), then it should be included in the HTML (don't forget the width, height and alt attributes). If it's just there to sit pretty and look good (something most celebrities can claim to be their only real skill) then put it in the background via CSS where it belongs.
     
    Dan Schulz, Aug 16, 2007 IP