问题
I want to write several object attributes in a singular table tab each on a new line
here's my pug table code excerpt
table#posts(style="float:right; border: 1px solid green")
tbody
each post in data
tr
td(style="border: 1px solid green")='Name: ' + post.firstname + ' ' + post.lastname + 'Date of Birth: ' + post.dob
td(style="border: 1px solid green") buttons
else
tr
td No posts!
I want the new line to be between the Name and date of birth. Any help is appreciated, thank you!
回答1:
Add a <br />
tag
table#posts(style="float:right; border: 1px solid green")
tbody
each post in data
tr
td(style="border: 1px solid green")
| Name: #{post.firstname + ' ' + post.lastname}
br
| Date of Birth: #{post.dob}
td(style="border: 1px solid green") buttons
else
tr
td No posts!
You can also enclose name and date of birth text within a <p>
tag
回答2:
Put the text on a new line with a preceding |
:
table#posts(style="float:right; border: 1px solid green")
tbody
each post in data
tr
td(style="border: 1px solid green")
| 'Name: ' + post.firstname + ' ' + post.lastname
br
| 'Date of Birth: ' + post.dob
td(style="border: 1px solid green") buttons
else
tr
td No posts!
来源:https://stackoverflow.com/questions/49675099/how-to-trigger-a-new-line-in-jade-pug