Reputation: 8112
I am stuck at one place where I need to make a table inline with the p tag
but I am not able to do so. I want to do minimalist change in my HTML Style. Below is what I have tried
<p>ABCD</p>
<table style = display: inline;>
<tbody>
<tr>
<td>State </td>
<td>Capital </td>
<td>Zip </td>
</tr>
<tr>
<td>New Yrk </td>
<td>Alba ny </td>
<td>13210 </td>
</tr>
</tbody>
</table>
Link: https://jsfiddle.net/h5bbs0oy/
Upvotes: 2
Views: 3103
Reputation: 278
Making both display:inline works, but it will good if you only make p tag
float:left . No need to add display:inline on any of one, Also adding display:inline, you will not be able to add top and bottom padding or margin.
Upvotes: 0
Reputation: 13
If you want to make table inline using inline CSS Method, just follow this method:
<table style="display: inline">
<tbody>
<tr>
<td>State </td>
<td>Capital </td>
<td>Zip </td>
</tr>
<tr>
<td>New Yrk </td>
<td>Alba ny </td>
<td>13210 </td>
</tr>
</tbody>
</table>
The quotes in inline css was missing
Upvotes: -1
Reputation: 178
If you are looking at making both the paragraph and table inline, then have the display: inline on both the tags.
<p style="display: inline">ABCD</p>
<table style="display: inline">...
Upvotes: 1
Reputation: 167212
You have a few issues:
<p>
inline as well.Solution
<p style="display: inline;">ABCD</p>
<table style="display: inline;">
Snippet
<p style="display: inline;">ABCD</p>
<table style="display: inline;">
<tbody>
<tr>
<td>State </td>
<td>Capital </td>
<td>Zip </td>
</tr>
<tr>
<td>New Yrk </td>
<td>Alba ny </td>
<td>13210 </td>
</tr>
</tbody>
</table>
Preview
Upvotes: 2