Grow your CSS skills. Land your dream job.

When to use empty divs + background-image property

  • # December 10, 2008 at 2:47 pm

    Hi all,
    Basic question: When should you use background images as opposed to placing images in your html. I’ve noticed that some folks use empty divs with and set images using the background-image property as much as possible. I am wondering when is that advantageous and when should you just go ahead and stick the image tag in your html? Hope this isn’t to general a question.

    Brandon

    Rob
    # December 10, 2008 at 5:11 pm

    Sometimes it is sometimes it isnt :)

    In the design of your site, you should use the BG image to bring in images that arnt that important. I use the old <img> tag on things that I want for example google to pick up on. On the front page of my site i have some UL’s set up to display some of the services I offer, the image in the first LI I could have pulled in as a BG image, but instead I used a <img> tag. The reason I did this is its now an actual important element in the site, with all the decriptive text info it needs to be searched.

    In my opinion – <img> things that arnt site stucture, but are things like images in posts or your gallery, this way you give google something else to chew on :)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".