CATEGORII DOCUMENTE |
Example
<html xmlns='https://www.w3.org/1999/xhtml'> <head> <body> </html> |
Example
<html> <body> </html> |
Example
Source |
Output |
<h1>This is header 1</h1> |
This is header 1 This is header 2 This is header 3 This is header 4 This is header 5 This is header 6 |
Example
Source |
Output |
|||
<p>This is some text in a very short paragraph</p> |
This is some text in a very short paragraph |
|||
Attribute |
Value |
Description |
DTD |
|
align |
left |
Specifies the alignment of the text within the paragraph. Deprecated. Use styles instead |
TF |
|
Differences Between HTML and XHTML
In HTML the <br> tag has no end tag.
In XHTML the <br> tag must be properly closed, like this: <br />.
Tips and Notes
Note: Use the <br> tag to enter blank lines, not to separate paragraphs.
Example
Source |
Output |
This text contains<br />a line break |
This text contains |
Differences Between HTML and XHTML
In HTML the <hr> tag has no end tag.
In XHTML the <hr> tag must be properly closed.
All 'presentation attributes' of the hr element were deprecated in HTML 4.01.
All 'presentation attributes' of the hr element are not supported in XHTML 1.0 Strict DTD.
Example
Source |
Output |
This is some text <hr /> This is some text |
This is some text This is some text |
Optional Attributes
DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
Attribute |
Value |
Description |
DTD |
align |
center |
Specifies the alignment of the horizontal rule. Deprecated. Use styles instead |
TF |
noshade |
noshade |
When set to true the rule should render in a solid color, when set to false the rule should render in a two-color 'groove'. Deprecated. Use styles instead |
TF |
size |
pixels |
Specifies the thickness (height) of the horizontal rule. Deprecated. Use styles instead |
TF |
width |
pixels |
Specifies the width of the horizontal rule Deprecated. Use styles instead |
TF |
Example
Source |
Output |
<!--This text is a comment--> <p>This is a regular paragraph</p> |
This is a regular paragraph |
HTML <a> tag HTML <a> tag HTML <a> tag
Example
Source |
Output |
<p>Linking to W3Schools: <p> |
Linking to W3Schools: W3Schools Opening W3Schools a new browser window: W3Schools |
Optional Attributes
DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
Attribute |
Value |
Description |
DTD |
charset |
character_encoding |
Specifies the character encoding of the target URL |
STF |
coords |
if shape='rect' then if shape='circ' then if shape='poly' then |
Specifies the coordinates appropriate to the shape attribute to define a region of an image for image maps |
STF |
href |
URL |
The target URL of the link |
STF |
hreflang |
language_code |
Specifies the base language of the target URL |
STF |
name |
section_name |
Names an anchor. Use this attribute to create a bookmark in a document. In future versions of XHTML the name attribute will be replaced by the id attribute!! |
STF |
rel |
alternate |
Specifies the relationship between the current document and the target URL |
STF |
rev |
alternate |
Specifies the relationship between the target URL and the current document |
STF |
shape |
rect |
Defines the type of region to be defined for mapping in the current area tag. Used with the coords attribute. |
STF |
target |
_blank |
Where to open the target URL. _blank - the target URL will open in a new window _self - the target URL will open in the same frame as it was clicked _parent - the target URL will open in the parent frameset _top - the target URL will open in the full body of the window |
TF |
type |
mime_type |
Specifies the MIME (Multipurpose Internet Mail Extensions) type of the target URL |
STF |
HTML <abbr> tag HTML <abbr> tag HTML <abbr> tag
Example
Source |
Output |
<abbr title='United Nations'>UN</abbr> |
UN |
HTML <acronym> tagHTML <acronym> tag HTML <acronym> tag
Example
Source |
Output |
<acronym title='World Wide Web'>WWW</acronym> |
WWW |
HTML <address> tag HTML <address> tag HTML <address> tag
Example
Source |
Output |
<address> |
Donald Duck |
HTML <area> tag
HTML <area> tag
Example
Source |
Output |
<p>Click on one of the planets:</p> <img src ='planets.gif' |
Click on one of the planets:
|
HTML <tt> <i> <b> <big> <small> tags
Definition and Usage
The following elements are all font style elements. They are not deprecated, but it is possible to achieve richer effects using style sheets.
<tt> |
Renders as teletype or mono spaced text |
<i> |
Renders as italic text |
<b> |
Renders as bold text |
<big> |
Renders as bigger text |
<small> |
Renders as smaller text |
Differences Between HTML and XHTML
NONE
Example
Source |
Output |
<tt>Teletype text</tt><br /> |
Teletype
text |
TML <blockquote> tag
Definition and Usage
The <blockquote> tag defines the start of a long quotation.
Differences Between HTML and XHTML
The <blockquote> tag is supposed to contain only block-level elements within it, and not just plain text.
To validate the page as strict XHTML, you must add a block-level element around the text within the <blockquote> tag, like this:
<blockquote>
<p>here is a long quotation here is a long quotation</p>
</blockquote>
Tips and Notes
Note: The blockquote element creates white space on both sides of the text.
Example
Source |
Output |
Here comes a long quotation: <blockquote> here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation </blockquote> |
Here comes a long quotation: here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation |
HTML <button> tag
Definition and Usage
Defines a push button. Inside a button element you can put content, like text or images. This is the difference between this element and buttons created with the input element.
Differences Between HTML and XHTML
NONE
Example
Source |
Output |
<button>Click Me!</button> |
Click Me! |
HTML <caption> tag
Definition and Usage
This element defines a table caption. The <caption> tag must be inserted immediately after the <table> tag. You can specify only one caption per table. Usually the caption will be centered above the table.
Differences Between HTML and XHTML
The 'align' attribute of the caption element was deprecated in HTML 4.01.
The 'align' attribute of the caption element is not supported in XHTML 1.0 Strict DTD.
Example
Source |
Output |
|
<table border='1'> |
This is a caption | |
Cell 1 |
Cell 2 |
Optional Attributes
DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
Attribute |
Value |
Description |
DTD |
align |
left |
How to align the caption. Deprecated. Use styles instead. |
TF |
HTML <em> <strong> <dfn> <code> <samp> <kbd> <var> <cite> tags
Definition and Usage
The following elements are all phrase elements. They are not deprecated, but it is possible to achieve a much richer effect using style sheets.
<em> |
Renders as emphasized text |
<strong> |
Renders as strong emphasized text |
<dfn> |
Defines a definition term |
<code> |
Defines computer code text |
<samp> |
Defines sample computer code |
<kbd> |
Defines keyboard text |
<var> |
Defines a variable |
<cite> |
Defines a citation |
Differences Between HTML and XHTML
NONE
Example
Source |
Output |
<em>Emphasized text</em><br /> |
Emphasized text |
HTML <col> tag
Definition and Usage
Defines the attribute values for one or more columns in a table. You can only use this element inside a table or a colgroup.
Differences Between HTML and XHTML
In HTML the <col> tag has no end tag.
In XHTML the <col> tag must be properly closed.
Tips and Notes
Note: The col element is an empty element that contains attributes only. To create columns, you must specify td elements within a tr element.
Tip: Use this element when you want to specify different attribute values to a column inside a colgroup. Without a col element a column will inherit all its attribute values from the colgroup.
Example
Source |
Output |
||||
This example shows a colgroup that has three columns of
different widths: |
This example shows a colgroup that has three columns of different widths: | ||||
1 |
2 |
3 |
4 |
Optional Attributes
DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
Attribute |
Value |
Description |
DTD |
align |
right |
Defines the horizontal alignment of the content in the table cell, in the column |
STF |
char |
character |
Defines a character to use to align text on (use with align='char') |
STF |
charoff |
pixels |
Defines an alignment offset to the first character to align on, as set with char |
STF |
span |
number |
Defines the number of columns the <col> should span |
STF |
valign |
top |
Defines the vertical alignment of the content in the table cell, in the column |
STF |
width |
% |
Defines the width of the column. Note: Overrides the width set in <colgroup> |
STF |
HTML <colgroup> tag
Definition and Usage
Defines groups of table columns. With this element, you can group columns for formatting. This element is only valid inside the <table> tag.
Differences Between HTML and XHTML
NONE
Tips and Notes
Note: The colgroup element is an empty element that contains attributes only. To create columns, you must specify td elements within a tr element.
Example
This example creates a table with four columns, with the first three columns in one colgroup, and the last column in the second colgroup:
Source |
Output |
||||
<table border='1'> |
1 |
2 |
3 |
4 |
HTML <dd> tag
Definition and Usage
The <dd> tag defines the description of a term in a definition list.
Differences Between HTML and XHTML
NONE
Example
Source |
Output |
<dl> |
Coffee Black hot drink Milk White cold drink |
HTML <del> tag
Definition and Usage
Defines text that has been deleted in a document.
Differences Between HTML and XHTML
NONE
Tips and Notes
Tip: Use it together with the <ins> tag to describe updates and modifications in a document.
Example
Source |
Output |
a dozen is <del>20</del> 12 pieces |
a dozen is 20 12 pieces |
HTML <dir> tag
Definition and Usage
The <dir> tag defines a directory list.
Differences Between HTML and XHTML
The dir element was deprecated in HTML 4.01.
The dir element is not supported in XHTML 1.0 Strict DTD.
Tips and Notes
Tip: Use CSS styles to define the type of list!
Example
Source |
Output |
<dir> |
html xhtml |
HTML <div> tag
Definition and Usage
The <div> tag defines a division/section in a document.
Differences Between HTML and XHTML
The 'align' attribute of the div element was deprecated in HTML 4.01.
The 'align' attribute of the div element is not supported in XHTML 1.0 Strict DTD.
Tips and Notes
Note: Browsers usually place a line break before and after the div element.
Tip: Use the <div> tag to group block-elements to format them with styles.
Example
Source |
Output |
This is some text <div
style='color:#FF0000;'> |
This is some text This is a header in a div section This is a paragraph in a div section |
Optional Attributes
DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
Attribute |
Value |
Description |
DTD |
align |
left |
How to align the text in the div element. Deprecated. Use styles instead. |
TF |
HTML <fieldset> tag
Definition and Usage
The fieldset element draws a box around its containing elements.
Differences Between HTML and XHTML
NONE
Example
Source |
Output |
<fieldset> |
Height Weight |
HTML <font> tag
Definition and Usage
The <font> tag specifies the font face, font size, and font color of text.
Differences Between HTML and XHTML
The font element was deprecated in HTML 4.01.
The font element is not supported in XHTML 1.0 Strict DTD.
Tips and Notes
Tip: Use styles (instead of the <font> tag) to define the font face, font size, and font color of text.
Example
Source |
Output |
<font size='3' color='red'> |
This is some text! This is some text! This is some text! |
Optional Attributes
DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
Attribute |
Value |
Description |
DTD |
color |
rgb(x,x,x) |
Defines the color of the text in the font element. Deprecated. Use styles instead |
TF |
face |
list_of_fontnames |
Defines the font of the text in the font element. Deprecated. Use styles instead |
TF |
size |
A number from 1 to 7. |
Defines the size of the text in the font element. Deprecated. Use styles instead |
TF |
HTML <form> tag
Definition and Usage
The form element creates a form for user input. A form can contain textfields, checkboxes, radio-buttons and more. Forms are used to pass user-data to a specified URL.
Differences Between HTML and XHTML
NONE
Example
Source |
Output |
<form action='form_action.asp' |
First name:
If you click the 'Submit' button, you will send your input to a new page called form_action.asp. login!!!! |
HTML <frame> tag
Definition and Usage
Defines a sub window (a frame).
Differences Between HTML and XHTML
In HTML the <frame> tag has no end tag.
In XHTML the <frame> tag must be properly closed.
Tips and Notes
Note: If you want to validate a page containing frames, be sure the DTD is set to 'Frameset DTD'. Read more about XHTML Validation.
Important: You cannot use the <body></body> tags together with the <frameset></frameset> tags! However, if you add a <noframes> tag containing some text for browsers that do not support frames, you will have to enclose the text in <body></body> tags!
Example
Source |
Output |
<a href='planets.htm' target='_blank'>View this page for the result</a> The source code in 'planets.htm': |
View this page for the result https://www.w3schools.com/tags/planets.htm |
HTML <frameset> tag
Definition and Usage
The frameset element defines a frameset. It is used to organize multiple windows (frames). Each frame holds a separate document. In its simplest use, the frameset element states only how many columns or rows there will be in the frameset. You must use the cols or the rows attribute.
Differences Between HTML and XHTML
NONE
Tips and Notes
Note: If you want to validate a page containing frames, be sure the DTD is set to 'Frameset DTD'. Read more about XHTML Validation.
Important: You cannot use the <body></body> tags together with the <frameset></frameset> tags! However, if you add a <noframes> tag containing some text for browsers that do not support frames, you will have to enclose the text in <body></body> tags!
Example
Source |
Output |
<a href='planets.htm' target='_blank'>View this page for the result</a> The source code in 'planets.htm': |
View this page for the result |
HTML <iframe> tag
Definition and Usage
The iframe element creates an inline frame that contains another document.
Differences Between HTML and XHTML
NONE
Example
Source |
Output |
<iframe |
Optional Attributes
DTD indicates in which DTD the attribute is allowed. S=Strict, T=Transitional, and F=Frameset.
Attribute |
Value |
Description |
DTD |
align |
left |
Specifies how to align the iframe according to the surrounding text |
TF |
frameborder |
1 |
Specifies whether or not to display a frame border |
TF |
height |
pixels |
Defines the height of the iframe |
TF |
longdesc |
URL |
A URL to a long description of the frame contents |
TF |
marginheight |
pixels |
Defines the top and bottom margins of the iframe |
TF |
marginwidth |
pixels |
Defines the left and right margins of the iframe |
TF |
name |
frame_name |
Specifies a unique name of the iframe (to use in scripts) |
TF |
scrolling |
yes |
Define scroll bars |
TF |
src |
URL |
The URL of the document to show in the iframe |
TF |
width |
pixels |
Defines the width of the iframe |
TF |
HTML <img> tag
Definition and Usage
The img element defines an image.
Differences Between HTML and XHTML
In HTML the <img> tag has no end tag.
In XHTML the <img> tag must be properly closed.
The 'align', 'border', 'hspace', and 'vspace' attributes of the image element were deprecated in HTML 4.01.
The 'align', 'border', 'hspace', and 'vspace' attributes of the image element are not supported in XHTML 1.0 Strict DTD.
Mozilla Firefox and the alt Attribute
If you use the alt attribute in Firefox on images and image maps the text will not show on mouse-over as in other browsers.
Firefox uses the alt attribute the way it's meant to be used, like an alternative text if the image won't load, not as a mouse-over text.
Firefox does support mouse-over comments on images or image maps if you use a title attribute in the <img> tag.
E.g. <img src='image.gif' alt='bla' title='bla bla bla'
Example
Source |
Output |
<img src='angry.gif' alt='Angry' /> |
FPRIVATE 'TYPE=PICT;ALT=Angry' |
HTML <label> tag
Definition and Usage
Defines a label to a control. If you click the text within the label element, it is supposed to toggle the control.
Differences Between HTML and XHTML
NONE
Tips and Notes
Note: The 'for' attribute binds a label to another element. Set the value of the 'for' attribute equal to the value of the 'id' attribute of the related element.
Example
Source |
Output |
<p>Try clicking on the text labels:</p> <form name='input' action=''> |
Try clicking on the text labels:
Male https://www.w3schools.com/tags/tag_label.asp |
Definition and Usage
The <li> tag defines the start of a list item. The <li> tag is used in both ordered (<ol>) and unordered lists (<ul>).
Differences Between HTML and XHTML
The 'type' and 'value' attributes of the li element were deprecated in HTML 4.01.
The 'type' and 'value' attributes of the li element are not supported in XHTML 1.0 Strict DTD.
Tips and Notes
Tip: Use styles to define the type of list.
Examples
Source |
Output |
<ol> <ul> |
Coffee Tea Coffee Tea |
HTML <menu> tag
Definition and Usage
The <menu> tag defines a menu list.
Differences Between HTML and XHTML
The menu element was deprecated in HTML 4.01.
The menu element is not supported in XHTML 1.0 Strict DTD.
Tips and Notes
Tip: Use CSS styles to define the type of list!
Example
Source |
Output |
<menu> |
html xhtml |
HTML <noframes> tag
Definition and Usage
The noframes element displays text for browsers that do not handle frames. The noframes element goes inside the frameset element.
Differences Between HTML and XHTML
NONE
Tips and Notes
Note: If a browser handles frames, it will not display the text in the noframes element.
Important: If you add a <noframes> tag to a frameset, you will have to enclose the text in <body></body> tags!
Note: If you want to validate a page containing frames, be sure the DTD is set to 'Frameset DTD'. Read more about XHTML Validation.
Note: The <noframes> tag is not allowed in XHTML 1.0 Strict DTD.
Example
<frameset cols = '25%, 25%,*'> |
HTML <noscript> tag
Examples
JavaScript: VBScript: |
HTML <object> tag
Definition and Usage
Defines an embedded object. Use this element to add multimedia to your XHTML page. This element allows you to specify the data and parameters for objects inserted into HTML documents, and the code that can be used to display/manipulate that data.
Differences Between HTML and XHTML
NONE
Tips and Notes
Note: An object element can appear inside the head or the body element. The text between the <object> and </object> is the alternate text, for browsers that do not support this tag. The <param> tags define run-time settings for the object.
Tip: For images use the <img> tag instead of the <object> tag.
Example
Source |
Output |
<object
classid='clsid:F08DF954-8592-11D1-B16A-00C0F0283628'
id='Slider1' width='100' height='50'> |
clsid:F08DF954-8592-11D1-B16A-00C0F0283628 asta tebuie inlocuita |
HTML <optgroup> tag
Definition and Usage
Defines an option group. This element allows you to group choices. When you have a long list of options, groups of related choices are easier to handle.
Differences Between HTML and XHTML
NONE
Example
Source |
Output |
<select> |
https://www.w3schools.com/tags/tag_optgroup.asp |
HTML <option> tag
Definition and Usage
The option element defines an option in the drop-down list.
Differences Between HTML and XHTML
In HTML the <option> tag has no end tag.
In XHTML the <option> tag must be properly closed.
Tips and Notes
Note: The <option> tag can be used without any attributes, but you usually need the value attribute, which indicates what is sent to the server.
Note: Use this tag in conjunction with the select element, elsewhere it is meaningless.
Example
Source |
Output |
<select> |
HTML <pre> tag
Definition and Usage
The pre element defines preformatted text. The text enclosed in the pre element usually preserves spaces and line breaks. The text renders in a fixed-pitch font.
Differences Between HTML and XHTML
The 'width' attribute of the pre element was deprecated in HTML 4.01.
The 'width' attribute of the pre element is not supported in XHTML 1.0 Strict DTD.
Note on <pre>
It is worth noting that while <xmp> is deprecated, the <pre> tag does not perform all of the functions of <xmp>:
<pre><b>Hello</b></pre> displays Hello
<xmp><b>Hello</b></xmp> displays <b>Hello</b>
Example
Source |
Output |
<pre> |
HTML <q> tag
Definition and Usage
The <q> tag defines the start of a short quotation.
Differences Between HTML and XHTML
NONE
Tips and Notes
Note: According to the HTML 4.01 spec, the q element should render with delimiting quotation marks. This works in Mozilla browsers (Firefox) and Opera. Internet Explorer ignores this entirely.
Example
Source |
Output |
Here comes a short quotation: <q>here is a short quotation here is a short quotation</q> |
Here comes a short quotation: here is a short quotation here is a short quotation |
HTML <s> and <strike> tags
Definition and Usage
The <s> and <strike> tags defines strikethrough text.
Differences Between HTML and XHTML
The <s> and <strike> elements were deprecated in HTML 4.01.
The <s> and <strike> elements are not supported in XHTML 1.0 Strict DTD.
Tips and Notes
Tip: Use <del> instead!
Example
Source |
Output |
A new version is <s>not yet available.</s>
now available! |
A new version is |
HTML <script> tag
Definition and Usage
Defines a script, such as a JavaScript.
Differences Between HTML and XHTML
The 'language' attribute of the script element was deprecated in HTML 4.01.
The 'language' attribute of the script element is not supported in XHTML 1.0 Strict DTD.
Tips and Notes
Note: Code within this element is executed immediately when the page is loaded, if it is not in a function. Script that appears after a <frameset> tag will be ignored.
Example
Source |
Output |
<script type='text/javascript'> |
Hello World! |
HTML <span> tag
Definition and Usage
The <span> tag is used to group inline-elements in a document.
Differences Between HTML and XHTML
NONE
Tips and Notes
Tip: Use the <span> tag to group inline-elements to format them with styles
Example
Source |
Output |
<p>This is a paragraph <span style='color:#0000FF;'>This is a paragraph</span> This is a paragraph</p> <p> |
This is a paragraph This is a paragraph This is a paragraph This is another paragraph |
HTML <style> tag
Definition and Usage
Defines a style in a document.
The style element goes in the head section. If you want to include a style sheet in your page, you should define the style sheet externally, and link to it using <link>.
Differences Between HTML and XHTML
NONE
Tips and Notes
Tip: To learn more about style sheets, visit our CSS Tutorial.
Example
Source |
<head> |
HTML <sub> and <sup> tags
Definition and Usage
The <sub> tag defines subscript text. The <sup> tag defines superscript text.
Differences Between HTML and XHTML
NONE
Example
Source |
Output |
This text contains <sub>subscript</sub> |
This text contains subscript |
HTML <tbody> tag
Definition and Usage
Defines a table body.
The thead, tfoot and tbody elements enable you to group rows in a table. When you create a table, you might want to have a header row, some rows with data, and a row with totals at bottom. This division enables browsers to support scrolling of table bodies independently of the table header and footer. When long tables are printed, the table header and footer information may be repeated on each page that contains table data.
Differences Between HTML and XHTML
NONE
Tips and Notes
Note: The <tbody> must have a <tr> tag inside!
Note: If you use the thead, tfoot and tbody elements, you must use every element. They should appear in this order: <thead>, <tfoot> and <tbody>, so that browsers can render the foot before receiving all the data. You must use these tags within the table element.
Note: The <thead>,<tbody> and <tfoot> elements are seldom used, because of bad browser support. Expect this to change in future versions of XHTML. If you have Internet Explorer 5.0 or newer, you can view an example in our XML tutorial.
Example
Source |
Output |
<table border = '1'> |
This text is in the THEAD |
This text is in the TFOOT |
|
This text is in the TBODY |
HTML <textarea> tag
Definition and Usage
Defines a text-area (a multi-line text input control). A user can write text in the text-area. In a text-area you can write an unlimited number of characters. The default font in the text-area is fixed pitch.
Differences Between HTML and XHTML
NONE
Example
Source |
Output |
<textarea rows='2' cols='20'> |
HTML <th> tag
Definition and Usage
Defines a table header cell in a table. The text within the th element usually renders in bold.
Differences Between HTML and XHTML
The 'bgcolor', 'height', 'width', and 'nowrap' attributes of the th element were deprecated in HTML 4.01.
The 'bgcolor', 'height', 'width', and 'nowrap' attributes of the th element are not supported in XHTML 1.0 Strict DTD.
Example
Source |
Output |
||
<table border = '1'> |
Header 1 |
Header 2 | |
Cell A |
Cell B |
HTML <u> tag
Definition and Usage
The <u> tag defines underlined text.
Differences Between HTML and XHTML
The u element was deprecated in HTML 4.01.
The u element is not supported in XHTML 1.0 Strict DTD.
Tips and Notes
Tip: Do not underline text - a user confuses it with a hyperlink!!
Example
Source |
Output |
A new version is <u>now available!</u> |
A new version is now available! |
Politica de confidentialitate | Termeni si conditii de utilizare |
Vizualizari: 1640
Importanta:
Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved