beautypg.com

Xhtml code – Adobe Dreamweaver CC 2015 User Manual

Page 365

background image

358

Coding

Last updated 6/3/2015

The Roundtrip HTML capabilities in Dreamweaver let you move your documents back and forth between a text-based
HTML editor and Dreamweaver with little or no effect on the content and structure of the document’s original HTML
source code. These capabilities include the following:

• Use a third-party text editor to edit the current document.

• By default, Dreamweaver does not make changes in code created or edited in other HTML editors, even if the code

is invalid, unless you enable code-rewriting options.

• Dreamweaver does not change tags it doesn’t recognize—including XML tags—because it has no criteria by which

to judge them. If an unrecognized tag overlaps another tag (for example,
text), Dreamweaver marks it as an error but doesn’t rewrite the code.

• Optionally, you can set Dreamweaver to highlight invalid code in Code view (in yellow). When you select a

highlighted section, the Property inspector displays information on how to correct the error.

XHTML code

Dreamweaver generates new XHTML code and cleans up existing XHTML code in a way that meets most of the
XHTML requirements. The tools that you need to meet the few XHTML requirements that remain are also provided.

Note: Some of the requirements also are required in various versions of HTML.

The following table describes the XHTML requirements that Dreamweaver meets automatically:

XHTML requirement

Actions Dreamweaver performs

There must be a DOCTYPE declaration in the document prior to the
root element, and the declaration must reference one of the three
Document Type Definition (DTD) files for XHTML (strict, transitional, or
frameset).

Adds an XHTML DOCTYPE to an XHTML document:

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

Or, if the XHTML document has a frameset:

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

The root element of the document must be html, and the html
element must designate the XHTML namespace.

Adds the namespace attribute to the html element, as follows:

A standard document must have the head, title, and body structural
elements. A frameset document must have the head, title, and
frameset structural elements.

In a standard document, includes the head, title, and body elements.
In a frameset document, includes the head, title, and frameset
elements.

All elements in the document must nest properly:

This is a bad example.

This is a good
example.

Generates correctly nested code and, when cleaning up XHTML,
corrects nesting in code that was not generated by Dreamweaver.

All element and attribute names must be lowercase.

Forces HTML element and attribute names to be lowercase in the
XHTML code that it generates and when cleaning up XHTML,
regardless of your tag and attribute case preferences.

Every element must have a closing tag, unless it is declared in the DTD
as EMPTY.

Inserts closing tags in the code that it generates, and when cleaning
up XHTML.

Empty elements must have a closing tag, or the opening tag must end
with />. For example,
is not valid; the correct form is


or
. Following are the empty elements: area, base, basefont, br,
col, frame, hr, img, input, isindex, link, meta, and param.

And for backwards-compatibility with browsers that are not XML-
enabled, there must be a space before the /> (for example,
, not

).

Inserts empty elements with a space before the closing slash in empty
tags in the code that it generates, and when cleaning up XHTML.