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 Quote 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. Quote 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 Quote 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 Quote 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. Quote 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 Quote 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>'; Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.