cyfer65 Posted July 24, 2011 Share Posted July 24, 2011 is there anyway to make an invisible/transparent rectangle a clickable link..? Link to comment Share on other sites More sharing options...
Drycodez Posted July 24, 2011 Share Posted July 24, 2011 (edited) 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 July 24, 2011 by O. Samuel Link to comment Share on other sites More sharing options...
Drycodez Posted July 24, 2011 Share Posted July 24, 2011 or make the link a block element. E.g: <a href="xxxx.html" style="display:block; height:100px; width:100px">click anywere!</a> 1 Link to comment Share on other sites More sharing options...
Synook Posted July 24, 2011 Share Posted July 24, 2011 You're not allowed to put divisions inside anchors so the second method is best . Link to comment Share on other sites More sharing options...
Drycodez Posted July 24, 2011 Share Posted July 24, 2011 You're not allowed to put divisions inside anchors so the second method is best .why? I tried it some time ago and it works! Link to comment Share on other sites More sharing options...
Synook Posted July 24, 2011 Share Posted July 24, 2011 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 More sharing options...
Drycodez Posted July 24, 2011 Share Posted July 24, 2011 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 More sharing options...
Johnildo Posted April 7, 2016 Share Posted April 7, 2016 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now