Button with link not working
Author | Message |
---|---|
Kleader | # Posted two weeks ago |
Hi I don't know what's the problem with my button but the link isn't working properly. <a href="siteraw.html"><button id="bt"></button></a>Any help is appreciated. |
|
Ads | |
Bougnoulz | # Posted one week ago |
I tested your code, it works. Do you get an error message? What browser are you using? |
|
Kleader | # Posted yesterday |
Google Chrome but I also tried with Internet Explorer and I get the same problem. | |
Kim Jong Un | # Posted yesterday |
Hello, the <button> element cannot be nested within a <a>. Why do you need to do that anyway? Just apply CSS (via the bt class I suppose?) directly to the link.You might have to change the display to block as <a> is inline by default. |
|
Demand3d | # Posted two hours ago |
Strange as it works under Linux (Debian) with Firefox, Chrome, Opera and even the internal browser of Komodo-edit. With that said, Kim Jong Un's remark is very pertinent. |
|
Kegon | # Posted one hour ago |
It's not because it "works" on some browsers (more permissive on the syntax), that it is valid and thus compatible. | |
Celeri | # Posted 37 minutes ago |
The documentation is pretty clear on this matter.The Anchor elementYou can still do the opposite since <button> allows the inclusion of HTML content (it's why the tag was created after all). <button class="bt"> |
|
Kleader | # Posted 5 minutes ago |
Thanks! I'll try that method. |