How to align a paragraph to center of cell in table
I want the paragraph in the second row to be aligned to center of table. How can I do that?
Full HTML & CSS code in this link
CSS:
table {
width:100%;
}
table, td {
border-collapse:collapse;
开发者_C百科 border:1px solid black;
padding:0px 5px 10px;
}
.separate {
text-align:center;
}
.separate p{
border:1px solid lightgray;
width:50%;
}
table:
<table>
<tr>
<td>AAA</td>
<td>BBB</td>
<td>CCC</td>
</tr>
<tr>
<td colspan="3" class="separate" >
<p>paragrap</p>
</td>
</tr>
</table>
Give the p left and right margin auto margins.
.separate p{
border:1px solid lightgray;
margin:0 auto;
width:50%;
}
精彩评论