Home / Community & Support / Knowledge Base / RadControls for ASP.NET and ASP.NET AJAX / Editor / Applying indentation or alignment per line

Applying indentation or alignment per line

Article Info

Rating: 5

Article information

Article relates to

RadEditor for ASP.NET AJAX
Telerik.Web.UI (all versions)

Created by

Rumen Zhekov

HOW-TO
Applying indentation or alignment per line

DESCRIPTION
RadEditor uses the Rich Text Editing engine of the browser under which it operates. The default behavior of Internet Explorer is to apply the indentation and alignment to the whole paragraph rather than to a single line/word of text. The same behavior could be observed in MS Word as well.

The solution below describes how to indent or align only the selected line.

SOLUTION
All you need to do is setting the editor's NewLineMode property to "P". Thus the editor will insert a paragraph tag on every enter-key press and the user will be able to apply the indentation and alignment per line.

The NewLineMode property was introduced because of browser differences when the user presses 'Enter'. In IE a paragraph is inserted, while Firefox inserts a <br> tag. By default this property is set to "Br", the editor insert <br/> tags and for that reason the indentation is applied to the whole content, because there is only one paragraph and all the content is inside it.

Additionally, to reduce the extra space between the paragraph blocks inside the editor's content area, you should set a global CSS paragraph style in your page, i.e.

P  
{  
    margin:0px;  
}   
 
blockquote   
{   
    margin-top0px;       
    margin-bottom0px;   

The blockquote style is used to remove the extra space when indentation is applied.

Comments

  • Randolph , Dec 21, 2008

    Great! Just what I'm looking for.

If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.