Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Using an Image as a Link
Old 03-18-2011, 10:01 AM Using an Image as a Link
asmalik12's Avatar
Extreme Talker

Posts: 173
Name: Abdullah Saleem
Trades: 0
Hi,

How can I use an Image as link so that It doesn't show Image path and other characteristics in Right Click?
__________________
"Think 100 times before you take a decision, But once that decision is taken, stand by it as one man." - Quaid-e-Azam
asmalik12 is offline
Reply With Quote
View Public Profile Visit asmalik12's homepage!
 
 
Register now for full access!
Old 03-18-2011, 03:44 PM Re: Using an Image as a Link
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Set it as background to an element with a block anchor overlayed.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-24-2011, 09:35 PM Re: Using an Image as a Link
asmalik12's Avatar
Extreme Talker

Posts: 173
Name: Abdullah Saleem
Trades: 0
How can I do that?
__________________
"Think 100 times before you take a decision, But once that decision is taken, stand by it as one man." - Quaid-e-Azam
asmalik12 is offline
Reply With Quote
View Public Profile Visit asmalik12's homepage!
 
Old 03-25-2011, 10:03 AM Re: Using an Image as a Link
Super Spam Talker

Posts: 879
Name: Paul W
Trades: 0
Look at W3 Schools - some great basic CSS instruction pages.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is offline
Reply With Quote
View Public Profile
 
Old 03-25-2011, 10:23 AM Re: Using an Image as a Link
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Code:
#image_link {
      width: NNNpx;
      height: NNNpx;
      padding: 0;
}
#image_link a {
     display: block;
}
HTML Code:
<div id="image_link">
    <a href="URI"></a>
</div>
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-26-2011, 05:16 AM Re: Using an Image as a Link
asmalik12's Avatar
Extreme Talker

Posts: 173
Name: Abdullah Saleem
Trades: 0
I tried it, but failed!

HTML Code:
<div id="headerLogo_link">
<a href="<?php echo get_settings('home'); ?>/" title="<? bloginfo('name'); ?>"><img src="<?php bloginfo('template_url'); ?>/images/logo.png" alt="<?php bloginfo('description'); ?>" border="0" /></a></div>

CSS
Code:
#headerLogo_link {
      width: 250px;
      height: 94px;
      padding: 0;
}
#headerLogo_link a {
     display: block;
}
__________________
"Think 100 times before you take a decision, But once that decision is taken, stand by it as one man." - Quaid-e-Azam
asmalik12 is offline
Reply With Quote
View Public Profile Visit asmalik12's homepage!
 
Old 03-26-2011, 09:46 AM Re: Using an Image as a Link
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Well you will have to add the background image properties to the #headerLogo_link rules rather than have the image in the element!
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-26-2011, 11:52 AM Re: Using an Image as a Link
shivaji's Avatar
Ultra Talker

Posts: 321
Trades: 0
background: transparent url(images/logo.png) no-repeat scroll 0 0;
__________________

Please login or register to view this content. Registration is FREE
- uncommon free scripts

Please login or register to view this content. Registration is FREE
- Städte, Sport, Party, Gourment, Apartments, Hotels
shivaji is offline
Reply With Quote
View Public Profile Visit shivaji's homepage!
 
Old 03-26-2011, 11:58 AM Re: Using an Image as a Link
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Should work if the images folder is one level below the stylesheet location.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-26-2011, 01:02 PM Re: Using an Image as a Link
asmalik12's Avatar
Extreme Talker

Posts: 173
Name: Abdullah Saleem
Trades: 0
Thanx, dudes. It worked, but not as a link

HTML Code:
<a href="<?php echo get_settings('home'); ?>/" title="<? bloginfo('name'); ?>">What should I add here it make 240 x 94 image a link</a></div>
Code:
#headerLogo_link {
      background: transparent url(images/logo.png) no-repeat scroll 0 0;
      width: 250px;
      height: 94px;
      padding: 0;
}
#headerLogo_link a {
     display: block;
}
__________________
"Think 100 times before you take a decision, But once that decision is taken, stand by it as one man." - Quaid-e-Azam

Last edited by asmalik12; 03-26-2011 at 01:05 PM..
asmalik12 is offline
Reply With Quote
View Public Profile Visit asmalik12's homepage!
 
Old 03-26-2011, 05:19 PM Re: Using an Image as a Link
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
So what didn't happen
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-26-2011, 10:19 PM Re: Using an Image as a Link
asmalik12's Avatar
Extreme Talker

Posts: 173
Name: Abdullah Saleem
Trades: 0
I just want a link to be working now and that is not working
__________________
"Think 100 times before you take a decision, But once that decision is taken, stand by it as one man." - Quaid-e-Azam
asmalik12 is offline
Reply With Quote
View Public Profile Visit asmalik12's homepage!
 
Old 03-27-2011, 03:23 AM Re: Using an Image as a Link
shivaji's Avatar
Ultra Talker

Posts: 321
Trades: 0
You are foget to start div. BTW did you try if is link working like plain link without php code. Maybe is something wrong in php not in html and css. If you have uploaded site we can check, send us link.

HTML Code:
<div id="headerLogo_link "><a href="<?php echo get_settings('home'); ?>/" title="<? bloginfo('name'); ?>">What should I add here it make 240 x 94 image a link</a></div>
__________________

Please login or register to view this content. Registration is FREE
- uncommon free scripts

Please login or register to view this content. Registration is FREE
- Städte, Sport, Party, Gourment, Apartments, Hotels
shivaji is offline
Reply With Quote
View Public Profile Visit shivaji's homepage!
 
Old 03-27-2011, 03:46 AM Re: Using an Image as a Link
asmalik12's Avatar
Extreme Talker

Posts: 173
Name: Abdullah Saleem
Trades: 0
Nope, I'm trying it all on localhost, not on a live site.

My code is following:
PHP Code:
<div id="headerLogo_link "><a href="<?php echo get_settings('home'); ?>/" title="<? bloginfo('name'); ?>"></a></div>
What I wanna ask you is that when I write nothing in <a href="#">here</a>, It won't work as a link (Same is happening to me). There is nothing between <a href="#"> and </a>.

Everything else is working; logo is a background image now. But I just want link to my homepage from logo image. [Just link]
__________________
"Think 100 times before you take a decision, But once that decision is taken, stand by it as one man." - Quaid-e-Azam
asmalik12 is offline
Reply With Quote
View Public Profile Visit asmalik12's homepage!
 
Old 03-27-2011, 06:14 AM Re: Using an Image as a Link
shivaji's Avatar
Ultra Talker

Posts: 321
Trades: 0
Try to put width and height in #headerLogo_link a definition and keep display:block.
__________________

Please login or register to view this content. Registration is FREE
- uncommon free scripts

Please login or register to view this content. Registration is FREE
- Städte, Sport, Party, Gourment, Apartments, Hotels

Last edited by shivaji; 03-27-2011 at 06:16 AM..
shivaji is offline
Reply With Quote
View Public Profile Visit shivaji's homepage!
 
Old 03-27-2011, 07:20 AM Re: Using an Image as a Link
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
There is nothing between <a href="#"> and </a>.
Correct

Though I do owe you an apology, I missed adding height:100% to the rules for the descendant anchor.

Code:
#headerLogo_link a {
     display: block;
     height:100%;
}
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-27-2011, 10:57 PM Re: Using an Image as a Link
asmalik12's Avatar
Extreme Talker

Posts: 173
Name: Abdullah Saleem
Trades: 0
Thnx, dude. Working now...

Should I leave <a href="#"> and </a> as such?
__________________
"Think 100 times before you take a decision, But once that decision is taken, stand by it as one man." - Quaid-e-Azam

Last edited by asmalik12; 03-28-2011 at 12:30 AM..
asmalik12 is offline
Reply With Quote
View Public Profile Visit asmalik12's homepage!
 
Old 03-28-2011, 03:56 AM Re: Using an Image as a Link
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
'#' will be self-referencing (to the same page), so you do need to put the target URI in there, but yes, leave the anchor text completely empty (not even a space).

Otherwise it will show above the image.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 04-13-2011, 05:21 AM Re: Using an Image as a Link
bhuvamanish's Avatar
Novice Talker

Posts: 12
Name: Manish Patel
Trades: 0
Hi

From you code I think you are using wordpress. So may be below code will help you

Code:
<?php if  ( file_exists( TEMPLATEPATH . '/images/YOURIMAGEFILEHERE' ) ) { ?>   <a href="<?php echo get_settings('home'); ?>"><img src="<?php bloginfo('template_url'); ?>/images/YOURIMAGEFILEHERE" alt="<?php bloginfo('name'); ?>" /></a>   <?php } else { ?>   <h1><a href="<?php bloginfo('url'); ?>"><?php bloginfo('name'); ?></a></h1> <? } ?>
__________________
Tech News, Tech Blog, Tech FAQs, Blogging Tips, SEO Tricks, How to Guides & Tutorials @
Please login or register to view this content. Registration is FREE
bhuvamanish is offline
Reply With Quote
View Public Profile Visit bhuvamanish's homepage!
 
Reply     « Reply to Using an Image as a Link
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.95706 seconds with 12 queries