Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding image in a style
02-14-2007, 05:35 PM
Post: #1
Adding image in a style
Hi

How can I add an image to a CSS style. Say I need 'img.gif' as a background image for a particular style.

Thanks
Find all posts by this user
Quote this message in a reply
02-14-2007, 05:45 PM
Post: #2
RE: Adding image in a style
You can use the background-image property to set the backgound image inside a style

For eg: the following style would add a img.gif as the image background.

Code:
<style type="text/css">
.imgStyle {
    background-image: url('img.gif');
}
</style>

Code:
<div class="imgStyle">This is a background with image </div&gt;
Visit this user's website Find all posts by this user
Quote this message in a reply
02-14-2007, 05:56 PM
Post: #3
RE: Adding image in a style
Thanks. It worked.
Find all posts by this user
Quote this message in a reply
07-16-2014, 10:41 AM (This post was last modified: 07-16-2014 10:43 AM by marclewis.)
Post: #4
RE: Adding image in a style
Example:

style="background:url(image.jpg) no-repeat center center; width:150px, height: 150px;"
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Adding image to a table moonlight 5 4,420 04-11-2012 03:32 PM
Last Post: kevinpark

Forum Jump:


User(s) browsing this thread: 1 Guest(s)