How to trigger a new line in jade/pug?

后端 未结 2 1131
忘了有多久
忘了有多久 2020-12-20 00:57

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(s         


        
相关标签:
2条回答
  • 2020-12-20 01:17

    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

    0 讨论(0)
  • 2020-12-20 01:26

    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!
    
    0 讨论(0)
提交回复
热议问题