home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 1693
Discussions: 188,402, Posts: 2,243,609, Members: 232,632
Old January 7th, 2005, 06:27 AM   Digg it!   #1 (permalink)
Registered User
 
Join Date: Oct 2001
Posts: 4,097
css linking background image?

I have set a background-image in css. I'm wondering if it would be possible to turn this background-image into a link too? (im hoping to save myself some work)


Last edited by ClubMed : January 7th, 2005 at 06:31 AM.
ClubMed is offline   Reply With Quote
Old January 7th, 2005, 06:57 AM     #2 (permalink)
Ultimate Member
 
Join Date: Dec 2004
Posts: 1,558
I'm not entirely sure what you want accomplished but the answer is maybe. If you have a defined element, it can be a link. If it's just a background-image, probably not. If you are willing to share your source code and can better describe what you want, I can probably help. Here is a basic example how to turn an element into a link using javascript:
Code:
<TABLE cellpadding="0" cellspacing="0" border="1" width="200" height="200">
  <TR width="200">
    <TD onClick="window.open('http://www.google.com','_blank');" width="100" height="100" style="background-image: URL(http://www.lucidintegration.com/dbpro/link.gif);">
      &nbsp;
    </TD>
    <TD width="100" height="100" style="background-image: URL(http://www.lucidintegration.com/dbpro/nolink.gif);">
      &nbsp;
    </TD>
  </TR>
  <TR width="200">
    <TD width="100" height="100" style="background-image: URL(http://www.lucidintegration.com/dbpro/nolink.gif);">
      &nbsp;
    </TD>
    <TD onClick="window.open('http://www.hotscripts.com','_blank');" width="100" height="100" style="background-image: URL(http://www.lucidintegration.com/dbpro/link.gif);">
      &nbsp;
    </TD>
  </TR>
</TABLE>

large_nostril is offline   Reply With Quote
Old January 7th, 2005, 07:46 AM     #3 (permalink)
Registered User
 
Join Date: Oct 2001
Posts: 4,097
Here's my css code for the banner:

Code:
#banner {
        font-family: Verdana, Arial, sans-serif;
        color: #FFFFFF;
        background-color: #66442A;
        background-image: url(banner.gif);
        text-align: left;
        padding: 15px;
        border-bottom: 0px solid #FFFFFF;
        height: 169px;
        }
This is a banner that is displayed on all pages. As you can see, banner.gif is the background-image of the actual banner area. Only later did I realise that it would have been nicer to make the banner image a link back to the main site.

So to save myself the work of removing the background-image and pasting an image into the banner (+ all the work of reajusting the dimensions etc...) I was wondering if I could cheat somehow and just turn the background-image into a link, or perhaps i could turn the whole banner area (regardless of image) into a link?

ClubMed is offline   Reply With Quote
Old January 7th, 2005, 07:57 AM     #4 (permalink)
Ultimate Member
 
Join Date: Dec 2004
Posts: 1,558
Probably the best way to do it is to use a filler image (a transparent GIF that is 1x1px). Put the image in the area where your banner is at, and then give it the height= and width= attributes to have it the same size as the banner and make it a link. Something kinda like this:
Code:
<A HREF="yourlinkhere"><img src="filler.gif" width="100" height="169" border="0"></A>
Stick that in the area where your banner will appear and you now have a link.
Attached Images
 
large_nostril is offline   Reply With Quote
Old January 7th, 2005, 10:05 AM     #5 (permalink)
Registered User
 
Join Date: Oct 2001
Posts: 4,097
ah i like that idea, thanks!
ClubMed is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
frontpage problems nishark Webmastering and Programming 4 January 19th, 2003 03:00 AM

Most Active Discussions
Is It Just Me? (2906)
3-days in and no threads about Gaza (161)
Misery Loves Company... (2144)
New Build ( Finally ) (7)
CPU wont boot (7)
Building a gaming computer advice (5)
I think I just killed my computer w.. (24)
RCA 52Inch HDTV wont turn on (5)
Folderchat Weekday thread (444)
Recent Discussions
Futronix has water features? (0)
Laptop proccesor to desktop mob.. (2)
Please help! multiple problems! (4)
RCA 52Inch HDTV wont turn on (5)
New Build ( Finally ) (7)
Common Spyware Solutions (97)
How do you move a hard-drive to.. (4)
What is the best external enclo.. (0)
Partition Magic 7.0 (Unallocate.. (17)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 04:46 AM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28