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.

CSS Forum


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



Reply
Linking images with CSS?
Old 01-08-2010, 08:20 PM Linking images with CSS?
Novice Talker

Posts: 7
Trades: 0
I have no idea but I seem to not be able to link this picture to a hyperlink. Basically, I have an image and when you click on it, it will go to that directed hyperlink. For some reason, the linking isn't working and only the "bob" is showing and allowing the hyperlinking.

Code:
(PHP)
<div class="header">
        
    <h1><a href="la">
         bob</a>
    </h1>
</div>

(CSS)
.header {
    background: url(images/element_01.jpg);
    }
I also want to hide the "bob" text too. Thanks in advance.
yoman is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-08-2010, 09:11 PM Re: Linking images with CSS?
racer x's Avatar
Ultra Talker

Posts: 457
Name: Randy
Location: Northern Wisconsin
Trades: 0
The background area behind "bob" will only display whatever space "bob" is taking up. The background image doesn't "force" the width and height of the area. You must specify that.

You could set the link (<a href...>) to a width and height equal to the background image. You also have to set that link to display block then.

.header h1 a { width:100px; height:100px; display:block; }

(sub 100px for the background image width and height of course.)

Last edited by racer x; 01-08-2010 at 09:13 PM..
racer x is offline
Reply With Quote
View Public Profile Visit racer x's homepage!
 
Old 01-08-2010, 11:13 PM Re: Linking images with CSS?
Novice Talker

Posts: 7
Trades: 0
Thanks again but I still can't get the "bob" to hide but the picture is clickable .
Code:
(PHP)
<div class="header">
        
    <h1><a href="la">
         bob</a>
    </h1>
</div>

(CSS)
.header {
    background: url(images/element_01.jpg);
    }
.header h1 a { 
    width:300px; 
    height:300px; 
    display:block; 
    }
yoman is offline
Reply With Quote
View Public Profile
 
Old 01-09-2010, 05:53 AM Re: Linking images with CSS?
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,371
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
just delete the word bob
__________________
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 01-09-2010, 01:09 PM Re: Linking images with CSS?
racer x's Avatar
Ultra Talker

Posts: 457
Name: Randy
Location: Northern Wisconsin
Trades: 0
Or to keep the text "there" in the code try:

.header h1 a { text-indent:-9999px; }
racer x is offline
Reply With Quote
View Public Profile Visit racer x's homepage!
 
Old 01-09-2010, 01:17 PM Re: Linking images with CSS?
Novice Talker

Posts: 7
Trades: 0
Quote:
Originally Posted by chrishirst View Post
just delete the word bob
Thanks a lot. Got it fixed now. I was using racer x's response earlier when I did some research but I didn't like how the text was pushed to the left like that but anyways, I got it to work.
yoman is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Linking images with CSS?
 

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.27232 seconds with 12 queries