<?php
print "<div style='text-align:center'>This text will be centered</div>";
?>
<? print '<div align="center">Centered Text</div>' ?>
IF you use the adove, remember to add a ; after the 'monaco said:Don't count on using style attributes inside div tags; not all platforms support this (think IE on pocket PC for one). It won't validate as anything but html 4.01 transitional or lower, but you can use this:.PHP:<? print '<div align="center">Centered Text</div>' ?>
<? print '<div align="center">Centered Text</div>'; ?>
Hitch said:IF you use the adove, remember to add a ; after the '
PHP:<? print '<div align="center">Centered Text</div>'; ?>
<? print '<div align="center">Centered Text</div>' ?>
<? print '<div align="center">Even More Centered Test</div>' ?>
Fully seconded.Dan said:Because you don't need PHP for that.
<?php echo 'test'; ?>
music_man said:Don't use short tags.
Use <?php
Also, make sure you add an ; after:
Also, you don't need php for straight HTML, it parses slower.
<?php
echo 'test'
echo 'hi'
?>
