Jump to content

Leading spaces


niche
 Share

Recommended Posts

I think this is more of a php question.What do I need to change to display the leading spaces in $var1?Script:

<html><body><?php$var1 = "                  (1 div)";echo '<p> 14th & Pine Lake Rd'.$var1.'</p>';?></body></html>

Thanks

Edited by niche
Link to comment
Share on other sites

You could use   for each space. Or instead of using spaces you could use <span> tags around "(1 div)" and style it with some padding on the left.The <span> is probably the better option. Adjust the padding to whatever you need.

<span style="padding-left: 150px">(1 div)</span>

Edited by music_lp90
Link to comment
Share on other sites

The <span> is probably definitely the better option.
That's the correct way to do things. You could then adjust it with either padding or margins. A margin would probably work better. Edited by ShadowMage
Link to comment
Share on other sites

How would the <span> solution work?
<?php$var1 = "<span style='margin-left: 120px;'>(1 div)</span>";echo '<p> 14th & Pine Lake Rd'.$var1.'</p>';?>

You could also take this a step farther and create a class for that span if you're going to be repeating this pattern multiple times.

Edited by ShadowMage
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...