Strict DTD
Strict DTD is used when XHTML page contains only markup language. Strict DTD is used together with cascading style sheets, because this attribute does not allow CSS property in body tag.
Syntax:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
Example 2: In this example we will see the code for writing an XHTML document with an example for strict DTD.
html
<? xml version = "1.0" encoding = "UTF-8" ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> < html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en" > < head > < title >Strict DTD XHTML</ title > </ head > < body > < div style="color:#090;font-size:40px; font-weight:bold;text-align:center; margin-bottom:-25px;">w3wiki</ div > < p style = "text-align:center;font-size:20px;" > A computer science portal</ p > < p style = "text-align:center;font-size:20px;" > Option to choose month: < select name = "month" > < option selected = "selected" >January</ option > < option >February</ option > < option >March</ option > < option >April</ option > < option >May</ option > < option >June</ option > < option >July</ option > < option >Augusy</ option > < option >September</ option > < option >October</ option > < option >November</ option > < option >December</ option > </ select > </ p > </ body > </ html > |
Output:
XHTML Introduction
XHTML or EXtensible HyperText Markup Language is a mix of HTML and XML, very similar to HTML but stricter. It’s like a rulebook for creating web pages that browsers easily understand. Unlike HTML, you have to be careful and follow the rules exactly. Most browsers support it. Just think of it as a more precise way to write web code.
Table of Content
- History
- Transitional DTD
- Strict DTD
- Frameset DTD
- Why use XHTML?
- Benefits of XHTML
- Difference Between HTML and XHTML