Forum Moderators: not2easy
<div class="feature">
<a href="http://www.example.com"></a>
</div>
div.feature {
position: relative;
}
div.feature a {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
text-decoration: none; /* No underlines on the link */
z-index: 10; /* Places the link above everything else in the div */
background-color: #FFF; /* Fix to make div clickable in IE */
opacity: 0; /* Fix to make div clickable in IE */
filter: alpha(opacity=1); /* Fix to make div clickable in IE */
}
try it like this...
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>untitled document</title>
<style>
.feature {
position:relative;
padding:20px;
border:1px solid #000;
}
.feature a {
position:absolute;
display:block;
width:100%;
height:100%;
top:0;
left:0;
z-index:1;
text-decoration:none;
background-color:#fff;
opacity:0;
filter:alpha(opacity=0);
}
</style>
</head>
<body>
<div class="feature">
<a href="http://www.example.com"></a>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec
ultricies sollicitudin nisi, ut molestie felis adipiscing sit
amet. Sed auctor vehicula commodo. Nam a nibh neque, vitae
faucibus felis. Vivamus at metus eget eros consequat fringilla.
Quisque magna magna, laoreet eu tempus sit amet, fringilla at
tellus. Praesent felis tortor, scelerisque vitae fringilla
non, porttitor et lacus. Ut ut sapien nec quam tincidunt
consectetur in nec lacus.
</p><p>
Phasellus porta, dui a elementum egestas, odio sapien rhoncus
lorem, vitae bibendum erat sem eget sapien. Maecenas ut metus
ac quam pellentesque lacinia quis sit amet augue. Fusce eu
euismod urna. Nunc volutpat scelerisque tempus. Donec eget arcu
et mauris scelerisque tristique. Donec fringilla mauris dolor,
sit amet vulputate lacus. Nulla feugiat mattis nulla non
tincidunt. Nam sit amet dolor eros, a viverra lacus. Nunc quis
nisi eget neque tempus facilisis eu quis sapien.
</p>
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
I do not have the foggiest idea what VPS is. :(
But I do know that the code works splendidly in this selection of browsers...
- IE8 -> ->
- Firefox 34.0.5
- Chrome 39.0
- Opera 12.17
- Opera 26.0
- Safari 5.1.7
http://example.com/indexNEW.html
[edited by: not2easy at 8:19 pm (utc) on Jan 2, 2015]
[edit reason] Exemplified per TOS/ snipped review request [/edit]
are you saying the code that I gave you does
not work in Firefox on your home computer?
I think I need to keep my DOCTYPE the way I have it to specify that the code needs to be parsed as XHTML 1.0 Strict:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!DOCTYPE html>
<html lang="en">
<a href="http://www.example.com">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec
ultricies sollicitudin nisi, ut molestie felis adipiscing sit
amet. Sed auctor vehicula commodo. Nam a nibh neque, vitae
faucibus felis. Vivamus at metus eget eros consequat fringilla.
Quisque magna magna, laoreet eu tempus sit amet, fringilla at
tellus. Praesent felis tortor, scelerisque vitae fringilla
non, porttitor et lacus. Ut ut sapien nec quam tincidunt
consectetur in nec lacus.
</p><p>
Phasellus porta, dui a elementum egestas, odio sapien rhoncus
lorem, vitae bibendum erat sem eget sapien. Maecenas ut metus
ac quam pellentesque lacinia quis sit amet augue. Fusce eu
euismod urna. Nunc volutpat scelerisque tempus. Donec eget arcu
et mauris scelerisque tristique. Donec fringilla mauris dolor,
sit amet vulputate lacus. Nulla feugiat mattis nulla non
tincidunt. Nam sit amet dolor eros, a viverra lacus. Nunc quis
nisi eget neque tempus facilisis eu quis sapien.
</p>
</a>
How to Make a div a Clickable Link
http://localhost/BibleWebSite/indexNEW.html
http://example.com/indexNEW.html
[edited by: not2easy at 8:11 pm (utc) on Jan 2, 2015]
[edit reason] Exemplified domain per TOS [/edit]
While that does indeed work, it’s actually a hack. The reason for this is when you wrap a div with a link (like the code above) the markup will not validate as proper HTML since the syntax is incorrect.
But when I run the same indexNEW.html file from the copy on the public_html directory on my VPS--a publicly accessible Internet Web server--then it does not work.
I've always done everything so that it would validate as XHTML 1.0 Strict. Do you see a problem here? Is XHTML becoming passe?
For Web sites to display correctly, always use the latest version of your browser. This Web site displays best in
[edited by: not2easy at 7:36 pm (utc) on Jan 3, 2015]
[edit reason] referenced edited snippets [/edit]
[edited by: not2easy at 7:34 pm (utc) on Jan 3, 2015]
[edit reason] referenced edited snippets [/edit]
This is from an author who seems also to have written articles on HTML5. However, I do grant that when I tried the wrapping method with mattur's recommended DOCTYPE, it DID pass the validator because it was treated as HTML5.
I would appreciate any comments you might have of this issue. My Web site in question here has over 1000 Web pages (my biggest), but it is only one of eight that I've created. I've always done everything so that it would validate as XHTML 1.0 Strict. Do you see a problem here? Is XHTML becoming passe?
(4) I was unaware that there was so "hard" a connection between XHTML and XML. I thought XML was simply another alternative to HTML5 and XHTML. Any clarification you could give would be most appreciated.
I would be interested in how cached pages caused the problem.
Since origin servers do not always provide explicit expiration times, HTTP caches typically assign heuristic expiration times, employing algorithms that use other header values (such as the Last-Modified time) to estimate a plausible expiration time. The HTTP/1.1 specification does not provide specific algorithms, but does impose worst-case constraints on their results. Since heuristic expiration times might compromise semantic transparency, they ought to used cautiously, and we encourage origin servers to provide explicit expiration times as much as possible.
If none of Expires, Cache-Control: max-age, or Cache-Control: s-maxage ... appears in the response, and the response does not include other restrictions on caching, the cache MAY compute a freshness lifetime using a heuristic. The cache MUST attach Warning 113 to any response whose age is more than 24 hours if such warning has not already been added.
if the response does have a Last-Modified time, the heuristic expiration value SHOULD be no more than some fraction of the interval since that time. A typical setting of this fraction might be 10%.
[edited by: lucy24 at 9:19 pm (utc) on Jan 3, 2015]
If Firefox doesn't appreciate the accomplishment of XHTML Strict and just parses the code as HTML, as mattur said, well, what can I do?