spacing to align lines..
Moderator: General Moderators
spacing to align lines..
You know how in books, or some news-posting systems on webpages, you'll see this double-spacing or sometimes triple-space inbetween words to align the end of lines? It aligns all the cols perfectly.. Well im curious as to how some php scripts do this... I've attempted to grab the string length of each line, and then add a space next to other spaces until the line is the length i set, but i am not able to just update 1 space. So has anyone done anything like this and like to shed some light? If i could figure out a way to limit str_replace to only 1 replace then i might be able to do it..
- SantaGhost
- Forum Commoner
- Posts: 41
- Joined: Mon Sep 15, 2003 11:54 am
i think your best guess on this is css (http://www.w3schools.com/css)
- Heavy
- Forum Contributor
- Posts: 478
- Joined: Sun Sep 22, 2002 7:36 am
- Location: Viksjöfors, Hälsingland, Sweden
- Contact:
Re: spacing to align lines..
CSS:
Try that.
It is not PHP. This is all client side. In fact PHP can not deal with this, as the impression on the user is totally dependent on the font faces and font sizes that are used aswell as what browser renders the output.
I believe it is the style="text-align:justify" part you are interested of.
Code: Select all
<div style="text-align:justify">This may be what you are looking for?This may be what you are looking for?This may be what you are looking for?This may be what you are looking for?This may be what you are looking for?This may be what you are looking for?This may be what you are looking for?This may be what you are looking for?This may be what you are looking for?</div>It is not PHP. This is all client side. In fact PHP can not deal with this, as the impression on the user is totally dependent on the font faces and font sizes that are used aswell as what browser renders the output.
I believe it is the style="text-align:justify" part you are interested of.
You can also use wordwrap() to automaticly wrap strings after a certain num of chars.