Reputation: 37
Desired HTML:
<br/>
<form id="contact-form" method="post" action="contact.php" role="form">
My Pug code was:
br
form#contact-form(method='post'action='contact.php' role='form')
But it's showing the error:
br is a self closing element:
<br/>
but contains nested content.
Upvotes: 2
Views: 1887
Reputation: 8040
Indenting the form
underneath the br
like you have in your code—
// incorrect
br
form
—tells Pug you're trying to create this HTML—
<br><form></form></br>
—which is invalid because line-break elements can't contain other elements.
Instead, place the line-break at the same indentation level the form, which tells Pug they should be siblings, like this—
// correct
br
form
—which will compile to:
<br>
<form></form>
Upvotes: 0
Reputation: 4652
If your code is located inside a div, your pug template would have to look like this:
div
br
form#contact-form(method='post'action='contact.php' role='form')
From the pug documentation
Remember:
</br>
isn't valid, because it's a self closing element.
<br/>
and <br>
are valid.
Upvotes: 3