NotesOnElements

NotesOnElements - 1. XHTML Elements (i.e. XHTML Tags) XHTML...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
1. XHTML Elements (i.e. XHTML Tags) XHTML tags are also called elements. For example we may say that the <p> is a tag, or we may also say that the <p> is an element. An element may contain any combination or none of the following: Other elements Character Data (also known as Text data or Parsed Character data known as #PCDATA) Attributes and their values. Consider the following example to understand the above issue: 1. 2. 3. 4. 5. In the above example: The <head> element starts in line 1 and it is closed in line 5. The <head> element contains other elements. But it does not contain any character (i.e. text) data. It does not have any attributes. The <title> element contains only character data and nothing else. For saving space on the paper, we have coded the <title> element in one line. Thus it starts and ends in the same line. However, if so desired, we could have coded it as shown below: <title> My Life Story </title> There are two instances of the meta element in line 3 and 4. o None of the <meta> elements contain any character data. o The <meta> elements does not contain any other elements. o However, the <meta> elements contain attributes like name and content. o Because the meta element does not contain any character data or other elements, it is called an empty element. o Be careful! An empty element does not contain any character data or other elements; however, it may still contain attributes. o Observe the starting and closing convention of the meta tags. Because these are empty elements, these are not closed using the formal </meta> tag. Instead, these are opened and closed in the same “opening” tag. In the above example, the <head> element contains the <title> and <meta> elements. Thus, we may call the <head> element the parent of the <title> and <meta> elements. On the other hand, the <title> and the <meta> elements are usually called the child of the <head> element. In XHTML, there are strict rules about the contents of an element. For example, the <head> element may contain the <title> element, but a <title> element cannot contain the <head> element. Often we do not know these strict rules. In those cases, we can do an Internet search. For example, if we want to know the valid parents or the valid children of the <p> element, we can go to the URL:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/03/2011 for the course INFS 3380 taught by Professor Ahmed during the Fall '11 term at Toledo.

Page1 / 4

NotesOnElements - 1. XHTML Elements (i.e. XHTML Tags) XHTML...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online