bob marley
bob marley

Reputation: 41

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:

enter image description here

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>

Upvotes: 0

Views: 79

Answers (1)

Schleis
Schleis

Reputation: 43690

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>'; 

Upvotes: 2

Related Questions