Jump to content

vertically and horizontally center two lines of text


niche

Recommended Posts

Deirdre's Dad told me last month that vertical-align works great on one line of text. How do I change this script to vertically (and horizontally) center two lines of text without changing the size of the div?

echo '<div style="float:left;width:171px;height:96px;text-align:center;display:table-cell;vertical-align:text-middle;background-color:yellow;">';   echo '<h1 >1/35 Scale House</h1>';echo '</div>';

Link to comment
Share on other sites

This does the trick:

echo '<div style="float:left;">';  echo '<h1 style="display:table-cell;vertical-align:middle;width:171px;height:96px;text-align:center;">1/35 Scale Panther</h1>';echo '</div>';

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...