Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jan 2012
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Is it possible to show an image with css?

    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?

  • #2
    New Coder
    Join Date
    Dec 2007
    Posts
    43
    Thanks
    9
    Thanked 0 Times in 0 Posts
    yep. also if you want that to be linked the correct way is to style the <a> tag with width,height,background
    http://anothera.net | New Era Art Group

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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...

  • #4
    New Coder
    Join Date
    Dec 2007
    Posts
    43
    Thanks
    9
    Thanked 0 Times in 0 Posts
    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

    div.abc
    {
    width: 200px;
    height: 200px;
    background: url(your_image_url.jpg) no-repeat;
    (optional) float: left;
    (optional) display: inline-block;
    (optional) clear: both;
    }
    Last edited by cixxy; 01-25-2012 at 02:44 AM.
    http://anothera.net | New Era Art Group

  • #5
    New Coder
    Join Date
    Jan 2012
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    But how do you keep the original image from showing on top of it?

  • #6
    New Coder
    Join Date
    Dec 2007
    Posts
    43
    Thanks
    9
    Thanked 0 Times in 0 Posts
    if the image is inside the div you can either do
    div.abc img
    {
    display:none;
    }

    or delete the <img /> inside of the div in html
    http://anothera.net | New Era Art Group

  • #7
    New Coder
    Join Date
    Jan 2012
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •