Jump to content

invisible/transparent rectangle clickable link..?


cyfer65
 Share

Recommended Posts

Try puting a <div> element inside an anchor.

<a href="xxxxx.html"> <div> </div></a>

make sure you giv the div element a width and height. EDIT: please note that this will work in some browser and ll not work in some. The best way to do it is to use the code below!

Edited by O. Samuel
Link to comment
Share on other sites

You're not allowed to put divisions inside anchors so the second method is best :).

Link to comment
Share on other sites

It works, but it is invalid - as in, it does not comply by the HTML document type definition:

<!ELEMENT A - - (%inline;)* -(A)	   -- anchor -->

<!ENTITY % fontstyle "TT | I | B | BIG | SMALL"><!ENTITY % phrase "EM | STRONG | DFN | CODE |				   SAMP | KBD | VAR | CITE | ABBR | ACRONYM" ><!ENTITY % special   "A | IMG | OBJECT | BR | SCRIPT | MAP | Q | SUB | SUP | SPAN | BDO"><!ENTITY % formctrl "INPUT | SELECT | TEXTAREA | LABEL | BUTTON"><!-- %inline; covers inline or "text-level" elements --><!ENTITY % inline "#PCDATA | %fontstyle; | %phrase; | %special; | %formctrl;">

In general, you aren't supposed to put block elements inside inline ones.

Link to comment
Share on other sites

It works, but it is invalid - as in, it does not comply by the HTML document type definition:
<!ELEMENT A - - (%inline;)* -(A)	   -- anchor -->
<!ENTITY % fontstyle "TT | I | B | BIG | SMALL"><!ENTITY % phrase "EM | STRONG | DFN | CODE |				   SAMP | KBD | VAR | CITE | ABBR | ACRONYM" > oh, ok!
Link to comment
Share on other sites

  • 4 years later...

or make the link a block element. E.g:

<a href="xxxx.html" style="display:block; height:100px; width:100px">click anywere!</a>

 

Hey bro, I know this post has some years, but I've signed up to thanks for that.

It might be quite obvious for web dev, but I struggled to find!

Thanks!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...