|
|
Post a Project »
Find a Professional HTML Freelancer!
Find a Freelancer to help you with your HTML projects
| |
|
 |
|
|
03-18-2011, 10:01 AM
|
Using an Image as a Link
|
Posts: 173
Name: Abdullah Saleem
|
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
|
|
|
|
03-18-2011, 03:44 PM
|
Re: Using an Image as a Link
|
Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
|
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?
|
|
|
|
03-24-2011, 09:35 PM
|
Re: Using an Image as a Link
|
Posts: 173
Name: Abdullah Saleem
|
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
|
|
|
|
03-25-2011, 10:03 AM
|
Re: Using an Image as a Link
|
Posts: 879
Name: Paul W
|
Look at W3 Schools - some great basic CSS instruction pages.
|
|
|
|
03-25-2011, 10:23 AM
|
Re: Using an Image as a Link
|
Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
|
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?
|
|
|
|
03-26-2011, 05:16 AM
|
Re: Using an Image as a Link
|
Posts: 173
Name: Abdullah Saleem
|
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
|
|
|
|
03-26-2011, 09:46 AM
|
Re: Using an Image as a Link
|
Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
|
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?
|
|
|
|
03-26-2011, 11:52 AM
|
Re: Using an Image as a Link
|
Posts: 321
|
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
|
|
|
|
03-26-2011, 11:58 AM
|
Re: Using an Image as a Link
|
Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
|
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?
|
|
|
|
03-26-2011, 01:02 PM
|
Re: Using an Image as a Link
|
Posts: 173
Name: Abdullah Saleem
|
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..
|
|
|
|
03-26-2011, 05:19 PM
|
Re: Using an Image as a Link
|
Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
|
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?
|
|
|
|
03-26-2011, 10:19 PM
|
Re: Using an Image as a Link
|
Posts: 173
Name: Abdullah Saleem
|
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
|
|
|
|
03-27-2011, 03:23 AM
|
Re: Using an Image as a Link
|
Posts: 321
|
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
|
|
|
|
03-27-2011, 03:46 AM
|
Re: Using an Image as a Link
|
Posts: 173
Name: Abdullah Saleem
|
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
|
|
|
|
03-27-2011, 06:14 AM
|
Re: Using an Image as a Link
|
Posts: 321
|
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..
|
|
|
|
03-27-2011, 07:20 AM
|
Re: Using an Image as a Link
|
Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
|
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?
|
|
|
|
03-27-2011, 10:57 PM
|
Re: Using an Image as a Link
|
Posts: 173
Name: Abdullah Saleem
|
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..
|
|
|
|
03-28-2011, 03:56 AM
|
Re: Using an Image as a Link
|
Posts: 42,380
Name: Chris Hirst
Location: Blackpool. UK
|
'#' 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?
|
|
|
|
04-13-2011, 05:21 AM
|
Re: Using an Image as a Link
|
Posts: 12
Name: Manish Patel
|
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
|
|
|
|
|
« Reply to Using an Image as a Link
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|