I have this code :
table
{
border:solid 2px black;
width:100%; /*must*/
}
td
{
border:solid 2px red;
padding:5px;
}
span
{
border:solid 2px green;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<table>
<tr>
<td>
<span >There's already existing policy for : fugfuj tyutyuty</span>
</td>
</tr>
</body>
</html>
I want to align the span
to the center of TD
.
I can do text-align:center
but the TD
is about to host future -injected-ajax -html so I don't want to touch it ( and start playing with remove/apply text-align:center
).
I could also do width:200px;display:block;
and then : margin:0 auto;
but I dont know its length.
So before I go to JS solution :
Question
Is there any CSS only solution to center the span ?
related jsbin : http://jsbin.com/qokizunibifa/2/edit