CKEditor Samples » Producing XHTML Compliant Output

This sample shows how to configure CKEditor to output valid XHTML 1.1 code. Deprecated elements (<font>, <u>) or attributes (size, face) will be replaced with XHTML compliant code.

To add a CKEditor instance outputting valid XHTML code, load the editor using a standard JavaScript call and define CKEditor features to use the XHTML compliant elements and styles.

A snippet of the configuration code can be seen below; check the source of this page for full definition:

CKEDITOR.replace( 'textarea_id', {
	contentsCss: 'assets/outputxhtml.css',

	coreStyles_bold: {
		element: 'span',
		attributes: { 'class': 'Bold' }
	},
	coreStyles_italic: {
		element: 'span',
		attributes: { 'class': 'Italic' }
	},

	...
});

Rich Text EditorEditor toolbarsDocument Source Save New Page Preview Print TemplatesClipboard/Undo Cut Copy Paste Paste as plain text Paste from Word Undo RedoEditing Find Replace Select All Check Spelling Spell Check As You Type Forms Form Checkbox Radio Button Text Field Textarea Selection Field Button Image Button Hidden FieldBasic Styles Bold Italic Underline Strike Through Subscript Superscript Remove FormatParagraph Insert/Remove Numbered List Insert/Remove Bulleted List Decrease Indent Increase Indent Block Quote Create Div Container Align Left Center Align Right Justify Text direction from left to right Text direction from right to leftLinks Link Unlink AnchorInsert Image Flash Table Insert Horizontal Line Smiley Insert Special Character Insert Page Break for Printing IFrameStylesStylesStylesFormatFormatFontFontSizeSizeColors Text Color  Background Color Tools Maximize Show Blocksabout About CKEditorPress ALT 0 for helpElements path