,
The XHTML Tag : The XHTML Tag Tanja Petrova 5 Most tags come in matched pairs – 1 opening/start tag
that marks the beginning of a piece of content; and 1 closing/end tag
that marks the end A paragraph would look like this:This is a short paragraph to show start and end tags in XHTML.
The XHTML Element : The XHTML Element Tanja Petrova 6 The opening and closing tags, along with the content between them, form a complete element. In XHTML, all elements MUST have a closing tag…well, almost all.
The XHTML Element : The XHTML Element Tanja Petrova 7 Some tags represent empty elements that cannot hold content. Empty elements are self-closed – they need only one tag that is the entire element e.g.
This tag represents a line break – any text that follows it will be forced by the browser to wrap to a new line.
The XHTML Attribute : The XHTML Attribute Tanja Petrova 8 An element’s opening tag can contain attributes that provide more information about the element. An attribute is made up of an attribute name and an attribute value:
Welcome to our class on XHTML!
Attribute name = class Attribute value = greetingThe XHTML Attribute : The XHTML Attribute Tanja Petrova 9 An attribute’s name and value are connected by an equal sign, and the value must be enclosed in quotation marks “attribute value” All attribute names MUST be lowercase in XHTML. Several attributes can be included in the same opening tag:
My name is Tanja. What’s yours?
The XHTML Element cont’d : The XHTML Element cont’d Tanja Petrova 10 Element Opening Tag Closing Tag
Welcome to our class!
Name Value Content AttributeThe XHTML Element : The XHTML Element Tanja Petrova 11 Types of Elements: Block-level – these contains a block of content that needs its own line, to break apart long text into more manageable portions e.g. lists
; and headings
The XHTML Element : The XHTML Element Tanja Petrova 12 Types of Elements:
Inline – these contain shorter strings of text and are rendered adjacent to other text on the same line e.g. emphasis & ; computer code ; and abbreviations
The XHTML Element : The XHTML Element Tanja Petrova 13 Types of Elements: All block-level elements can contain inline elements
Hi
Many block-level elements can contain other block-level elementsHi
Inline elements can only contain other inline elements USSRThe XHTML Element : The XHTML Element Tanja Petrova 14 Nesting: When elements are nested, closing tags MUST appear in the correct order. A nested element must be closed BEFORE its containing element
This is WRONG
This is CORRECT
The XHTML Element : The XHTML Element Tanja Petrova 15 White Space: Browsers ignore line breaks and carriage returns so:
Plenty of empty white space!
will look like this in your browser: Plenty of empty white space!The XHTML Attribute cont’d : The XHTML Attribute cont’d Tanja Petrova 16 Core Attributes: class – elements that belong to the same class can have similar presentation. A class name is made up of letters, numbers, hyphens and underscores. Infinite elements may belong to the same class. A single element may belong to more than one class.
Just some text.
More text here!
Even more text.
The XHTML Attribute : The XHTML Attribute Tanja Petrova 17 Core Attributes: id – a unique identifier for an element. More than one element CANNOT share the same id within 1 document. A id name can contain letters, numbers, hyphens and underscores. An id name MUST start with a letter.
This will not work.
Neither will this.
This will also fail.
The XHTML Attribute : The XHTML Attribute Tanja Petrova 18 Core Attributes: title – gives a title to the element. Many browsers display the value of a title attribute in a tooltip, a small floating window that shows when a cursor hovers over the element
I love playing tennis and volleyball in my spare time. I also collect rubber ducks and used spoons.
The XHTML Attribute : The XHTML Attribute Tanja Petrova 19 Core Attributes: style – specifies CSS properties for an element. This is also known as inline styling. Although valid, this attribute should be avoided as it mixes structure with presentation.
Don’t use the style attribute in your XHTML, as it mixes your structure (HTML) with your presentation (CSS). That’s a bad mix!
The XHTML Attribute : The XHTML Attribute Tanja Petrova 20 Internationalization Attributes: dir – sets the direction in which text must be read. The values are ltr (left to right) or rtl (right to left). This is usually unnecessary lang – sets the language of the content. Some values are en, es, jp xml:lang – also sets the language of the content. Same values as the attribute above
XHTML Comments : XHTML Comments Tanja Petrova 21 It can be helpful to add comments to your documents. A comment starts with . A browser will not display any content between these markers.
This will also be visible in your browser.
Slide 22 : Hope you enjoyed this presentation. Please come back again! 22 Tanja Petrova
Want to learn?
Sign up and browse through relevant courses.

Price:$50