View Full Version : Is it possible to show an image with css?

01-25-2012, 01:49 AM
I have an rss feed that I'm stripping images from because often they're big and throw off my layout. Is there a way to display a "placeholder" image in its place? I'm thinking maybe display as a block with height and width and a background image or something? Would that work?

01-25-2012, 02:05 AM
yep. also if you want that to be linked the correct way is to style the <a> tag with width,height,background

01-25-2012, 03:33 AM
Oh don't tease me! Tell me how to do it! LOL When I tried a block with a background image the real image showed over it--however, it was resized to my block so I am using that as my solution at the moment to at least resize the images down...

01-25-2012, 03:40 AM
um i dont actually understand what you're saying.
but say if you want a div to contain an image for a 200pixel by 200 box its
<div class="abc"></div>

then in your css... the (optional) tags will make the image on its own line

width: 200px;
height: 200px;
background: url(your_image_url.jpg) no-repeat;
(optional) float: left;
(optional) display: inline-block;
(optional) clear: both;

01-25-2012, 04:36 AM
But how do you keep the original image from showing on top of it?

01-25-2012, 05:15 AM
if the image is inside the div you can either do
div.abc img

or delete the <img /> inside of the div in html

01-25-2012, 06:07 AM
No, it's pulling from an rss feed--I can't touch the html. I'll try the display:none; and see if that works.