Thursday, May 26, 2016
What is HTML ?
HyperText Markup Language (HTML) is the main markup language for crting web pages and other information that can be displayed in a web browser.HTML is written in the form of HTML elements consisting of tags enclosed in angle brackets (like <html>), within the web page content. HTML tags most commonly come in pairs like <h1> and </h1>, although some tags represent empty elements and so are unpaired, for example <img>. The first tag in a pair is the start tag, and the second tag is the end tag (they are also called opening tags and closing tags). In between these tags web designers can add text, further tags, comments and other types of text-based content.The purpose of a web browser is to rd HTML documents and compose them into visible or audible web pages. The browser does not display the HTML tags, but uses the tags to interpret the content of the page.HTML elements form the building blocks of all websites. HTML allows s and objects to be embedded and can be used to crte interactive forms. It provides a mns to crte structured documents by denoting structural semantics for text such as hdings, paragraphs, lists, links, quotes and other items. It can embed scripts written in languages such as JavaScript which affect the behavior of HTML web pages.Web browsers can also refer to Cascading Style Sheets (CSS) to define the apprance and layout of text and other material. The W3C, maintainer of both the HTML and the CSS standards, encourages the use of CSS over explicit presentational HTML markup.Markup
HTML markup consists of several components, including elements (and their attributes), character-based data types, character references and entity references. Another important component is the document type declaration, which triggers standards mode rendering.The following is an example of the classic Hello world program, a common test employed for comparing programming languages, scripting languages and markup languages. This example is made using 9 lines of :
<!DOCTYPE html>
<html>
<hd>
<title>This is a title</title>
</hd>
<body>
<p>Hello world!</p>
</body>
</html>
(The text between <html> and </html> describes the web page, and the text between <body> and </body> is the visible page content. The markup text '<title>This is a title</title>' defines thebrowser page title.)This Document Type Declaration is for HTML5. If the <!DOCTYPE html> declaration is not included, various browsers will revert to "quirks mode" for rendering.Elements
HTML documents are composed entirely of HTML elements that, in their most eral form have three components: a pair of tags, a "start tag" and "end tag"; some attributes within the start tag; and finally, any textual and graphical content between the start and end tags, perhaps including other nested elements. The HTML element is everything between and including the start and end tags. ch tag is enclosed in angle brackets.The eral form of an HTML element is therefore: <tag attribute1="value1" attribute2="value2">content</tag>. Some HTML elements are defined as empty elements and take the form <tag attribute1="value1" attribute2="value2" >. Empty elements may enclose no content, for instance, the BR tag or the inline IMG tag. The name of an HTML element is the name used in the tags. Note that the end tag's name is preceded by a slash character, "/", and that in empty elements the end tag is neither required nor allowed. If attributes are not mentioned, default values are used in ch case.Element examplesHder of the HTML document:<hd>...</hd>. Usually the title should be included in the hd, for example:<hd>
<title>The Title</title>
</hd>
Hdings: HTML hdings are defined with the<h1>to<h6>tags:<h1>Hding1</h1>
<h2>Hding2</h2>
<h3>Hding3</h3>
<h4>Hding4</h4>
<h5>Hding5</h5>
<h6>Hding6</h6>
Paragraphs:<p>Paragraph 1</p> <p>Paragraph 2</p>
Line brks:<br />. The difference between <br /> and <p> is that 'br' brks a line without altering the semantic structure of the page, whers 'p' sections the page into paragraphs. Note also that 'br' is anempty elementin that, while it may have attributes, it can take no content and it may not have an end tag.<p>This <br /> is a paragraph <br /> with <br /> line brks</p>
Comments:<!-- This is a comment -->
Comments can help in the understanding of the markup and do not display in the webpage.There are several types of markup elements used in HTML:Structural markup describes the purpose of textFor example, <h2>Golf</h2> establishes "Golf" as a second-level hding. Structural markup does not denote any specific rendering, but most web browsers have default styles for element formatting. Content may be further styled using Cascading Style Sheets (CSS).
Presentational markup describes the apprance of the text, regardless of its purposeFor example <b>boldface</b> indies that visual output devices should render "boldface" in bold text, but gives little indiion what devices that are unable to do this (such as aural devices that rd the text aloud) should do. In the case of both <b>bold</b> and <i>italic</i>, there are other elements that may have equivalent visual renderings but which are more semantic in nature, such as <strong>strong text</strong> and <em>emphasised text</em> respectively. It is sier to see how an aural user at should interpret the latter two elements. However, they are not equivalent to their presentational counterparts: it would be undesirable for a screen-rder to emphasize the name of a book, for instance, but on a screen such a name would be italicized. Most presentational markup elements have become depreed under the HTML 4.0 specifiion in favor of using CSS for styling.
AttributesMost of the attributes of an element are name-value pairs, separated by "=" and written within the start tag of an element after the element's name. The value may be enclosed in single or double quotes, although values consisting of certain characters can be left unquoted in HTML (but not XHTML) .Lving attribute values unquoted is considered unsafe.[46] In contrast with name-value pair attributes, there are some attributes that affect the element simply by their presence in the start tag of the element,[5] like the ismap attribute for the img element.[47]There are several common attributes that may appr in many elements :The id attribute provides a document-wide unique identifier for an element. This is used to identify the element so that stylesheets can alter its presentational properties, and scripts may alter, animate or delete its contents or presentation. Appended to the URL of the page, it provides a globally unique identifier for the element, typically a sub-section of the page. For example, the ID "Attributes" in http://en.wikipedia.org/wiki/HTML#AttributesThe class attribute provides a way of classifying similar elements. This can be used for semantic or presentation purposes. For example, an HTML document might semantically use the designation class="notation" to indie that all elements with this class value are subordinate to the main text of the document. In presentation, such elements might be gathered together and presented as footnotes on a page instd of appring in the place where they occur in the HTML source. Class attributes are used semantically in microformats. Multiple class values may be specified; for example class="notation important" puts the element into both the 'notation' and the 'important' classes.An author may use the style attribute to assign presentational properties to a particular element. It is considered better practice to use an element's id or class attributes to select the element from within a stylesheet, though sometimes this can be too cumbersome for a simple, specific, or ad hoc styling.The title attribute is used to attach subtextual explanation to an element. In most browsers this attribute is displayed as a tooltip.The lang attribute identifies the natural language of the element's contents, which may be different from that of the rest of the document. For example, in an English-language document:
<p>Oh well, <span lang="fr">c'est la vie</span>, as they say in France.</p>
The abbreviation element,abbr, can be used to demonstrate some of these attributes:<abbr id="anId" class="jargon" style="color:purple;" title="Hypertext Markup Language">HTML</abbr>
This example displays asHTML; in most browsers, pointing the cursor at the abbreviation should display the title text "Hypertext Markup Language."
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment