|
Home >> FAQs/Tutorials >> XHTML Tutorials and Tips >> Index
XHTML Tutorials - Introduction To Tag and Attribute Syntax
By: FYICenter.com
Part:
1
2
3
4
A collection of 16 tutorial tips on XHTML 1.0 element tag and attribute syntax. Clear answers are provided with tutorial exercises on XHTML elements, opening and closing tags, element attributes, quoting attribute values, required attribute and values, case sensitivity, entering comments, protecting ampersand sign.
Topics included in this collection are:
- What Is an XHTML Element?
- How To Enter Comments into XHTML documents?
- How To Write the Opening Tag of an XHTML Element?
- How To Closing an XHTML Element?
- What Is Wrong with My <br> Tags?
- What Is Wrong with My <meta> Tags?
- How To Enter Element Content?
- Is XHTML Element Name Case Sensitive?
Please note that all tutorials in this collection are based on XHTML 1.0 specification.
What Is an XHTML Element?
An XHTML element is the basic building block of an XHTML document.
An XHTML element has the following features:
- An XHTML element must have a name.
- An XHTML element may have zero or more attributes.
- An XHTML element may or may not have any content.
Here is a good example of an XHTML element:
<a href="http://dev.fyicenter.com/">FYIcenter.com</a>
The above an XHTML element has:
- A name called "a", which is coded at the beginning of the opening tag.
- An attribute called "href", which is coded inside the opening tag. It also has a value specified after the "=" sign.
- A string of text as the content, which is coded between the opening tag and closing tag.
How To Enter Comments into XHTML documents?
If you want to enter comments into an XHTML document, you can use the comment
tag: "<!-- ... -->".
Here are some good examples of XHTML comments:
<!-- Start north banner -->...
<script type="text/javascript">
<!-- alert("Are you ok?"); -->
</script>...
<!-- A long ...
paragraph ...
of comments -->...
How To Write the Opening Tag of an XHTML Element?
When you are writing an XHTML element, you must start with its opening tag,
which contains the name of the element and attributes if needed. The opening
tag is enclosed in a pair of angle brackets: "<" and ">".
XHTML element names are predefined by the XHTML specification.
You can not make up your own tag names. Here are some good examples of
XHTML element opening tags:
- <html> - Opening tag of the html element.
- <head> - Opening tag of the head element.
- <title> - Opening tag of the title element.
- <body> - Opening tag of the body element.
- <p> - Opening tag of the p element.
- <script> - Opening tag of the script element.
How To Closing an XHTML Element?
Every XHTML element must be closed. There are two ways to close
an XHTML element:
- Using a closing tag, which is the element name prefixed with "/"
and enclosed in a pair of angle brackets: "<" and ">".
- Closing the opening tag immediately by placing "/" before
the ending bracket: ">".
Here are some good examples of closing XHTML elements:
- <html>...</html>- Closing the html element with a closing tag.
- <head>...</head> - Closing the head element with a closing tag.
- <title/> - Closing the title element immediately with no content.
- <body>...</body> - Closing the body element with a closing tag.
- <p>...</p> - Closing the p element with a closing tag.
- <script/> - Closing the script element immediately with no content.
(Continued on next part...)
Part:
1
2
3
4
|