How to embed image in CSS

Discussion in 'HTML & Website Design' started by shendel101, Jul 31, 2007.

  1. #1
    Hello fellows.. can anyone help figure out how to embed image in CSS besides
    like this
    {
    background: url(heaser.gif);
    }

    because the disadvantage of this css code is that it cannot follow the image width and height of the image.. unlike embedding the usual way like this..

    <td><img src="heaser.gif" /></td>

    this embedding style while acquire the image of width and height of heaser.gif the data cell fill acquire the with of it.. which enable you seeing the whole image unlike in CSS code it will not.. Is their a way to embed in css that acquire or follow the width and height of the embedded image.. thanks...
     
    shendel101, Jul 31, 2007 IP
  2. webdesigner

    webdesigner Well-Known Member

    Messages:
    489
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    110
    #2
    Just use...

    .image {
    background: url(heaser.gif);
    width:200px;
    height:200px;
    }
     
    webdesigner, Jul 31, 2007 IP
  3. shendel101

    shendel101 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    thanks for the suggestion.. but what is want is that data cell will follow what is the height of image... like when embedding image in data cell like this tag..

    <td><img src="heaser.gif" /></td>

    this tag above will automatically follow the height of the image of the <td> tag.. but when i use css code in embedding background it wont follow the height of the data cell.. i will just be background image.. Hope you get what i mean. :(
     
    shendel101, Jul 31, 2007 IP