|
-
Jan 12th, 2006, 10:34 AM
#1
[RESOLVED] make entire background clickable link?
is there a way using HTML or CSS to make the entire page a clickable link?
its the "Enter" page for the site.. and right now I have a large trans gif as the link (as well as a 10 second redirect).. but would rather have the whole page clickable...
Thanks!
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jan 12th, 2006, 11:39 AM
#2
Re: make entire background clickable link?
Something like this might be suitable
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Example</title>
<style>
BODY.enterPage{
cursor:hand;
}
</style>
<script>
function goto(){
location.href = "http://www.dogpile.com"
}
</script>
</head>
<body class="enterPage" onclick="goto();">
<a href="www.dogpile.com">Enter</a>
</body>
</html>
-
Jan 12th, 2006, 11:42 AM
#3
Re: make entire background clickable link?
thought of something like that.. but what if browser has scripts turned off? will that still work?
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jan 12th, 2006, 11:55 AM
#4
Re: make entire background clickable link?
this should work then right?
<body onclick="location.href='home.html';">
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jan 12th, 2006, 12:00 PM
#5
Re: make entire background clickable link?
I just tried that in Firefox with javascript turned off and it didn't work.
-
Jan 12th, 2006, 12:57 PM
#6
Re: make entire background clickable link?
ok.. soo.. how to do this a "safe" way?
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jan 14th, 2006, 04:56 AM
#7
Re: make entire background clickable link?
Put the whole page within an anchor tag.
-
Jan 14th, 2006, 04:58 AM
#8
Re: make entire background clickable link?
Or put an anchor somewhere and use CSS to make it cover the entire viewport. (But problematic with either scrolling or IE.)
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 16th, 2006, 10:14 AM
#9
Re: make entire background clickable link?
? I need examples of either of those (still learning!!)
if this helps.. there is NOTHING on the page but a background image
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jan 16th, 2006, 10:33 AM
#10
Re: make entire background clickable link?
-
Jan 16th, 2006, 10:35 AM
#11
Re: make entire background clickable link?
I'll assume HTML so here's the code including CSS
HTML Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Test</title>
<style type="text/css">
html
{
background-color: black;
}
body
{
overflow: hidden;
}
body>div a
{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: black url('entry.gif') center center no-repeat;
}
</style>
</head>
<body>
<div><a href="main"></a></div>
</body>
</html>
Change the background colour and "entry.gif" as needed.
-
Jan 16th, 2006, 10:52 AM
#12
Re: make entire background clickable link?
is this right? "body>div a"
it seems that whatever I have in that section doesnt work....
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jan 16th, 2006, 10:54 AM
#13
Re: make entire background clickable link?
That would be because you are using a bad browser ... 
It works perfectly fine in Firefox and Opera.
Have you read the bottom two links in my signature?
-
Jan 16th, 2006, 10:57 AM
#14
Re: make entire background clickable link?
lol
its because this "body>div a" should be just "div a"
then it works perfectly!!
I have to program for the "majority" and that means IE 
but it should work for FF & Opera as well...right?
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jan 16th, 2006, 11:02 AM
#15
Re: make entire background clickable link?
body>div is a perfectly valid, basic, part of the CSS specification. To be quite honest, I removed it and it still did not work for me in IE, but then not much does anyway.
I have a problem with "programming for the majority", because standards are not respected and so progress is never made. But do as you see fit
-
Jan 16th, 2006, 11:06 AM
#16
Re: make entire background clickable link?
it didnt work??
this is what I changed it too based on a few examples I found... body> wasnt used in the ones I saw....
Code:
div a
{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('bg_main.jpg');
background-repeat: no-repeat;
background-position: center;
background-color: black;
}
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jan 16th, 2006, 11:15 AM
#17
Re: make entire background clickable link?
Well that's actually exactly the same as what I had, minus the body>div child combinator in the selection rule. I only put it in in case you needed multiple div's, which you probably don't anyway 
To make it work properly in IE I needed to add "height: 100%;" to the body properties.
-
Jan 16th, 2006, 11:17 AM
#18
Re: make entire background clickable link?
Mind you, this method won't work if the content is long enough for scrolling. In that case, the link will simply scroll away.
position:relative;
would ignore scrolling, but doesn't work in IE.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 16th, 2006, 11:21 AM
#19
Re: make entire background clickable link?
cornedbee.. not to worry.. there is nothing but a background image on this.. no text etc...
Thanks all!!!
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jan 16th, 2006, 11:23 AM
#20
Re: [RESOLVED] make entire background clickable link?
No problem, and PLEASE at least consider using a better browser ... it will make your life much easier.
-
Jan 16th, 2006, 11:28 AM
#21
Re: [RESOLVED] make entire background clickable link?
I will consider it I guess...
I use maxthon, and I know its IE, but the features it has are just too good and so easy to use... basically its the drag link for new tab feature I cant live without
click drag a link a 1/4 inch (so it turns to a shortcut drop cursor) and let go.. bam that link opens in a new page.. love it too much! havent found another browser that does this
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
-
Jan 16th, 2006, 11:30 AM
#22
Re: [RESOLVED] make entire background clickable link?
-
Jan 16th, 2006, 11:49 AM
#23
Re: [RESOLVED] make entire background clickable link?
I can middle-click links for a new tab. How's that for simple?
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Jan 16th, 2006, 11:53 AM
#24
Re: [RESOLVED] make entire background clickable link?
JPnyc rocks!! (Just ask him!)
If u have your answer please go to the thread tools and click "Mark Thread Resolved"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|