Jump to content

vertically and horizontally center two lines of text


niche
 Share

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

Edited by niche
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...