Forum Moderators: open

Message Too Old, No Replies

Paragraph indentation

restoring the text indentation in browser

         

nithu

7:55 pm on Dec 19, 2006 (gmt 0)

10+ Year Member



Hi All,

I am having a problem with the paragraph indentation when I display the text in the browser.
I dont want to use any formatting tags like <p> or indent with &nbsp;&nbsp;

I have some text essays in the database and I display them in the browser. So if the essay has a new paragraph in it, I should be able to restore the indentaion and display it in the browser.

But what is happening is the paragraph is left justified and looks like a new line and not a new paragraph.
I am new to HTML, please advice...

Thanks,
nithu.

coopster

11:19 pm on Dec 19, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Hi nithu, welcome to WebmasterWorld.

Why not use <p> elements? Here nor there, you need to have some type of element and the paragraph seems the perfect fit. Then, all you need to do is apply style. The HTML is going to be your content whereas the CSS (stylesheets) will provide the markup. The CSS standards from the W3 [w3.org] are going to be a great resource for you. For example, have a look at some of the paragraph markup possibilities in the examples on this page from that site ...

[w3.org...]

And WebmasterWorld has a great forum for CSS support [webmasterworld.com]!

nithu

1:55 pm on Dec 20, 2006 (gmt 0)

10+ Year Member



I am sorry, I think I was not clear enough.
See, I have some essays answered by few candidates and while scoring them I get them from the database and display them.

So I have the exact format of the essay answered in the database, I dont want to do any formatting myself.
If the candidate started it as a new paragraph I will show it in a paragraph else not.

before we were displaying in a textarea but due to some reasons we started displaying directly in borwser and have lost the paragraph indentation.
So do I have any option of restoring the paragraph indentation of the text I display in a browser......

Thanks,
nithu.

coopster

2:27 pm on Dec 20, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



How about surrounding the information in <pre> (preformatted) elements? Should keep the whitespace intact as entered originally.

nithu

3:21 pm on Dec 20, 2006 (gmt 0)

10+ Year Member



Thank you for your replies.

This is what we are using:

<STYLE TYPE="text/css">
.textEssay{
font-size:<%= fontSize %>;
font-family:arial;
font-weight:bold;

}
</STYLE>

<PRE><DIV id=\"Div1\" "
+ " align=left style=\"width:95%;height:95%; border:0;overflow:auto; background-color:white\" "
+ " class=textEssay> " + txt
+ "</DIV></PRE>

Everything looks good, except the paragraph indentation.

Thanks,
Suneetha.

tedster

4:25 pm on Dec 20, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



you need the text-indent property in CSS

[w3.org...]

penders

12:58 pm on Dec 21, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I'm just curious as to how your candidates are indenting (first line) their paragraphs? - Are they indenting their paragraphs?

As I would have thought that if they are indenting their paragraphs with tabs or spaces, then this would be reproduced when you output the contents between <pre> tags, as coopster suggested, and which you seem to be doing. (?)

Another alternative, to the <pre> tags, is the CSS alternative:

.textEssay{ 
font-size:<%= fontSize %>;
font-family:arial;
font-weight:bold;
white-space:pre;
}

But browser support is not as good, if that is of concern.

nithu

4:13 pm on Dec 22, 2006 (gmt 0)

10+ Year Member



I am actually able to see the indentation with the <pre> tag. But whole paragraph is shown in one line which is very long and needs to be scrolled. The candidates have used line breaks only after each paragraph.
So we want to break by giving the width, that is the reason why we are using DIV tag. and now the essays look good, line breaks work properly after each paragraph but the paragraph indentation is lost........
So I am trying to do two things, restore the preformat and format the page width...... and this doesnt work.
In Netscape it is not a problem...... Only in IE I am having trouble... let me know if I am not clear....

Tried the CSS white-space you have mentioned, but it did not work.

Thanks for looking into this.

Regards,
Nithu.

nithu

8:07 pm on Dec 22, 2006 (gmt 0)

10+ Year Member



word-wrap: break-word in my css finally helped me to adjust the width and get rid of the long lines which I get in IE when I use <pre> tag.

Thanks,
Nithu.