简体   繁体   中英

Line break not working as expected

I'm using an API to display information about users.

When I try to implement a line break for presentation purposes, so as to have an information displayed below another, it fails to work and I can't seem to identify the reason for that unexpected behaviour.

Below is the image:

在此处输入图片说明

As you can see, both ID and Group are is displayed on the same line.

Here is my code:

<td>ID:</td><td><strong /> ' . $data['response']['id'] . '</td><br/>
<td>Group:</td><td><strong />' . $data['response']['groupName'];</td>

You are using a table. If you want the br to put the text on the next line, the text needs to be in the same table cell. Change your markup to:

<td>ID:<strong /> ' . $data['response']['id'] . '<br/>Group:<strong />' . $data['response']['groupName']</td>;

Or you could not use a br at all and just add a new table row:

<tr><td>ID:</td><td><strong /> ' . $data['response']['id'] . '</td></tr>
<tr><td>Group:</td><td><strong />' . $data['response']['groupName'].'</td></tr>'; 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM