floridaflatlander Posted April 4, 2011 Share Posted April 4, 2011 I have a string that I run through nlbr2(), nlbr() works fine but when I apply the css property text-indent it only indents the first line of text. So it looks like xxxxxxxxxxx xxxxxxxxxxxxxx (carriage return) xxxxxxxxxxxxxx xxxxxxxxxxxxxx And I want the text to look like this xxxxxxxxxxx xxxxxxxxxxxxxx (carriage return) xxxxxxxxxxx xxxxxxxxxxxxxx How do you text-indent with carriage returns ? Thanks in advance S Link to comment https://forums.phpfreaks.com/topic/232673-how-to-text-indent-with-carriage-returns/ Share on other sites More sharing options...
MatthewJ Posted April 4, 2011 Share Posted April 4, 2011 You use a margin or padding... text indent is supposed to do exactly what you're saying (indent the first line of the text like proper paragraph formatting calls for). In order to achieve what you're looking for, I would think you just need to split them into multiple paragraphs. Link to comment https://forums.phpfreaks.com/topic/232673-how-to-text-indent-with-carriage-returns/#findComment-1196713 Share on other sites More sharing options...
floridaflatlander Posted April 4, 2011 Author Share Posted April 4, 2011 If I use margin and/or padding it will narrow the whole artical. I just need the first line of every paragraph indented. Thats why I was using text-indent. Thanks Link to comment https://forums.phpfreaks.com/topic/232673-how-to-text-indent-with-carriage-returns/#findComment-1196718 Share on other sites More sharing options...
MatthewJ Posted April 4, 2011 Share Posted April 4, 2011 Well, then they have to be separate paragraphs... again, text-indent indents the first line of a pragraph Link to comment https://forums.phpfreaks.com/topic/232673-how-to-text-indent-with-carriage-returns/#findComment-1196720 Share on other sites More sharing options...
Pikachu2000 Posted April 4, 2011 Share Posted April 4, 2011 It isn't a paragraph unless it's in <p></p> tags. Linefeeds don't define a paragraph in html. Link to comment https://forums.phpfreaks.com/topic/232673-how-to-text-indent-with-carriage-returns/#findComment-1196721 Share on other sites More sharing options...
floridaflatlander Posted April 4, 2011 Author Share Posted April 4, 2011 I guess I shouldn't have used the word paragraph, I pondered what to call it for a few seconds before I posted the post. Is there anyway to indent the lines I'm talking about, if I can't indent them then I would expect that I couldn't put a space between them either. The way the (artical(?), text) looks now is all jumbled up. So can I indent them someway or is there a way I can put each string of text ending in a carriage return in html paragraph tags? Thanks again Link to comment https://forums.phpfreaks.com/topic/232673-how-to-text-indent-with-carriage-returns/#findComment-1196730 Share on other sites More sharing options...
Pikachu2000 Posted April 4, 2011 Share Posted April 4, 2011 Just make them actual paragraphs and use text-indent. If you're concerned about all of whatever you already have stored in a database table, you can echo an opening '<p> tag, str_replace() the linefeeds with '</p><p>', then echo the closing '</p>' tag. echo '<p class="whatever">'; echo str_replace("\n", "</p>\n<p class=\"whatever\">", $your_text); echo '</p>'; Link to comment https://forums.phpfreaks.com/topic/232673-how-to-text-indent-with-carriage-returns/#findComment-1196745 Share on other sites More sharing options...
floridaflatlander Posted April 4, 2011 Author Share Posted April 4, 2011 THAT !!!! Worked like a charm. Thanks Link to comment https://forums.phpfreaks.com/topic/232673-how-to-text-indent-with-carriage-returns/#findComment-1196785 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.