FRIHOSTFORUMSFAQTOSBLOGSDIRECTORY
You are invited to Log in or Register a Frihost Account!

[Resolved]Using css to create a link.

 


cr3ativ3
Hey, I have searched the web and these forums without luck I remember seeing this somewhere I thought I just can't track anything down anymore. This is more of a css hack I believe.

Is there a way of using css to create a link where there is no content. I have a table cell with a background image that changes on hover and off and the mouse changes to pointer I swap out the image as a background image. So there is no content in the cell what so ever I was wondering is there a way of making it so when a link like news:active is initiated it redirects the user to a new page? Something maybe like?

Code:

#news:active {
url('http://www.news.com/')
}


I know that doesn't work but I was wondering if there was a way of doing this in css or do you have another suggestion I might try for getting a link in these empty cells that span the full cell but are not visible.

Thanks.[/code]


Last edited by cr3ativ3 on Thu Sep 20, 2007 11:25 pm; edited 1 time in total
coreymanshack
cr3ativ3 wrote:
Hey, I have searched the web and these forums without luck I remember seeing this somewhere I thought I just can't track anything down anymore. This is more of a css hack I believe.

Is there a way of using css to create a link where there is no content. I have a table cell with a background image that changes on hover and off and the mouse changes to pointer I swap out the image as a background image. So there is no content in the cell what so ever I was wondering is there a way of making it so when a link like news:active is initiated it redirects the user to a new page? Something maybe like?

Code:

#news:active {
url('http://www.news.com/')
}


I know that doesn't work but I was wondering if there was a way of doing this in css or do you have another suggestion I might try for getting a link in these empty cells that span the full cell but are not visible.

Thanks.[/code]


I always use, <a href="#"></a> And it seems to work for me.
cr3ativ3
Ya, that would work if I had content in the cells but seeing as there is no content in the cells the link will have nothing to cover leaving the link non existent.

Thanks, Though.
coreymanshack
cr3ativ3 wrote:
Ya, that would work if I had content in the cells but seeing as there is no content in the cells the link will have nothing to cover leaving the link non existent.

Thanks, Though.


The link doesn't have to cover anything.

A link is a link.

Make the link width and hieght manually. If you're worried about clickable/veiwable link area with no content within.

You can also stick &nbsp in it.
cr3ativ3
Setting it manually didn't do a thing you can see here: http://saunders.oyoystudios.frih.net/template.html

The first link in the navigation bar "News" I did what you had said it didn't do anything.
coreymanshack
cr3ativ3 wrote:
Setting it manually didn't do a thing you can see here: http://saunders.oyoystudios.frih.net/template.html

The first link in the navigation bar "News" I did what you had said it didn't do anything.


I seem to get a link hover when I go over news?
cr3ativ3
THat's cause I have css changing the mouse to pointer and swapping the back image. But look at the code and click the link see what I meen?
coreymanshack
cr3ativ3 wrote:
THat's cause I have css changing the mouse to pointer and swapping the back image. But look at the code and click the link see what I meen?


You're right that it isn't working now I see, but I dont understand what you want to do in the first place. Maybe if you would say what you wanted to do I could help you.
cr3ativ3
Lol, I think this is becoming sorta flaming I was sorta in a bad mood when I had posted this I was tired it was like 12:00pm.

K sorry I probably wasn't clear in my topic starter. What I am trying to accomplish is to create a link with just css. So when #links:active is a called, when a user clicks the table cell it redirects the user to a new page. I am trying to have it redirect the user using css. I was wondering if there was a way of using css to redirect the user.

Like in my first post the example that doesn't work.

I hope that clears it up?
coreymanshack
cr3ativ3 wrote:
Lol, I think this is becoming sorta flaming I was sorta in a bad mood when I had posted this I was tired it was like 12:00pm.

K sorry I probably wasn't clear in my topic starter. What I am trying to accomplish is to create a link with just css. So when #links:active is a called, when a user clicks the table cell it redirects the user to a new page. I am trying to have it redirect the user using css. I was wondering if there was a way of using css to redirect the user.

Like in my first post the example that doesn't work.

I hope that clears it up?


Oh ok, I dont think there is a way to do that. I think you can put a blank image in the cell and link around it though to get the same effect.
cr3ativ3
Hmm... I tested the nav at school today and the css hover doesn't work on 98 IE6 I guess so I think I am going to use a javascript option.
coreymanshack
cr3ativ3 wrote:
Hmm... I tested the nav at school today and the css hover doesn't work on 98 IE6 I guess so I think I am going to use a javascript option.


That's weird I thought it worked there, you sure it isn't version 5?
cr3ativ3
Maybe it is IE5... Iono it looks like IE6 but then again the only two I am familiar with is IE6,7. I'll check tomorrow though in tech.

I changed the way I am using the links now. What I have done is created a link blockified and changed the size and added a background image so the css is this:

Code:

a.news {
width:90px;
height:55px;
display: block;
background-image:url('includes/images/news.gif')
}
a.news:hover {
width:90px;
height:55px;
display: block;
background-image:url('includes/images/newshover.gif')
}


and the html

Code:

<a href="index.html" class="news"></a>
Reply to topic    Frihost Forum Index -> Scripting -> Html, CSS and Javascript

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2007 Frihost, forums powered by phpBB.