3
I was using a library of Scaffold
for automatic HTML code generation. It was specifically for generating forms in Boostrap 3.
Then I noticed that the links of actions that are being generated are like this:
<a href="url_da_pagina">
<button class="btn btn-primary"></button>
</a>
Looks like the scaffold from that library was generating the code from Anchor
(The famous Link) with a Button
inside just to format the Link to be the same as the button.
But you don’t have to, in the bootstrap you can wear it like this:
<a href="" class="btn btn-primary">Tipo como se fosse um botão</a>
The question that came to me is: The automatic code generation library did this as if it were "something normal". It’s really "normal"?
Is there a problem in using a Button
within a A
, or vice versa?
I don’t know, but institively (no one told me anything or any article I read taught me that), I have a small impression that this is a bad practice (or gambiarra).
Is doing this valid? These lifetime html code validators would approve of putting a button inside a link ?
Not, just paste your code here and ask to validate.
– Renan Gomes
What is wrong with the question? Could you provide a suggested improvement
– Wallace Maxters
Related: It is acceptable to use <H2>, <H3>, <p>, <div> tags within links/anchors (<a></a>)?
– Guilherme Nascimento