Forum Moderators: open
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
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.
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]!
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.
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.
[w3.org...]
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.
Tried the CSS white-space you have mentioned, but it did not work.
Thanks for looking into this.
Regards,
Nithu.