HTML STRUCTURE SYNTAX INTRODUCTION This presentation introduces the





















- Slides: 21

HTML STRUCTURE & SYNTAX

INTRODUCTION This presentation introduces the following: § Doctype declaration § HTML Tags, Elements and Attributes § Sections of a Web document § Role of Web browser § Text editor § Saving and previewing files

WORLD WIDE WEB CONSORTIUM HTML 5 is a cooperation between the World Wide Web Consortium (W 3 C) and the Web Hypertext Application Technology Working Group (WHATWG).

DOCTYPE DECLARATION In HTML 5 there is only one <!doctype> declaration, and it is very simple: <!DOCTYPE html> The doctype is not an HTML tag. It is a declaration. It tells the browser the version of HTML.

WHAT IS HTML? HTML stands for Hyper Text Markup Language and is the primary language for building and creating web pages HTML is a markup language that uses markup tags which describe or define content in a Web document. (It is not a scripting or a programming language) HTML documents contain HTML tags and plain text which are often simply called web pages

HTML CODE HTML code is often referred to as source code. HTML can be coded using a plain text editor. When using a text editor, save the HTML document using the file extension. html or. htm

RULES FOR HTML TAGS HTML tags are keywords (tag names) and are enclosed inside angle brackets like <html> HTML tags occur in pairs with an opening and closing tag like <body> and </body> The first tag in a pair, the opening <body> indicates the start tag The second tag, the closing </body> indicates the end tag, and the end of the body section. The closing tag is written like the start tag but with the forward slash before the tag name. </body> The forward slash (/) ALWAYS precedes the tag name in a closing tag.

HTML TAGS The text between the HTML tags is keyed in plain text The following tags DO NOT have pairs and are often called “empty tags”: , <hr>, <img>, <meta> (These tags do not have information that you would put between an opening and closing tag) While HTML tags are not case sensitive, they are generally keyed in all lowercase letters.

WHAT IS AN HTML ELEMENT? An HTML element consists of everything between the start tag and the end tag, including the tags. For example: <h 1>This is heading style 1</h 1>

HTML ATTRIBUTE An HTML attribute gives elements additional meaning and context The image tag requires the src (source) attribute and the alt (alternative) attribute. The required alt attribute specifies an alternate text for an image, if the image cannot be displayed. The user defines the text in the alt tag.

WHAT IS AN ATTRIBUTE? Attributes - provide additional information about tags and control how the tag will be interpreted by the browser.

ATTRIBUTES Tags can have multiple attributes. Attributes have syntax rules: § Attributes are entered inside the opening tag but not in the closing tag. § Attributes are keyed in name/value pairs. Syntax: name=”value” § The attribute should have an equal symbol followed by the value or setting for the attribute. § Attribute values are enclosed within quotation marks.

MINIMUM HTML DOCUMENT <!DOCTYPE html> <head> <meta charset="UTF-8"> <title>Title of the document</title> </head> <body> Content of the document. . . </body> </html>

TWO SECTIONS IN A WEB PAGE An HTML document consists of two sections the <head> and the <body>. § The <head> section contains information about your page. § The <title> displays in the web browser title bar—not in the actual web document. The title must be in the <head> section. § The <meta> tag provides additional information about the document. § Internal and External CSS files are referenced in the <head> section. § The <body> section contains the visible content of your page.

HTML 5 AND AUDIO HTML 5 introduced a standard way to embed an audio file on a web page using the <audio> tag. The <audio> element allows multiple <source> elements can link to different audio files. The browser will use the first recognized format. Currently, there are 3 supported file formats for the <audio> element: MP 3, Wav, and Ogg

WEB BROWSER The purpose of a web browser (such as Google Chrome, Internet Explorer, Firefox, Safari) is to read HTML documents and display them as web pages. The browser does not display the HTML tags, but uses the tags to determine how the content of the HTML page is to be presented/displayed to the user.

HTML 5 AND VIDEO HTML 5 defines a new element which specifies a standard way to embed a video/movie on a web page: the <video> element. The <video> element allows multiple <source> elements can link to different video files. The browser will use the first recognized format. Currently, there are 3 supported video formats for the <video> element: MP 4, Web. M, and Ogg The purpose of the <object> element is to support HTML helpers (plug-ins). Plug-ins are often used by browsers to play audio and video. Examples of well-known plug-ins are Adobe Flash Player and Quick. Time. Plug-ins can be added to Web pages through the <object> tag or the <embed> tag.

WRITING HTML CODE A simple text editor can be used for coding a Web page. Using a text editor is a good way to learn coding. Web editors are also used for coding.

SAVING A FILE When you save an HTML file, you can use either the. htm or the. html file extension. There is no difference, it is entirely up to you. Save the file in a folder that is easy to remember Keep filenames short and descriptive. Avoid using spaces in filenames.

PREVIEWING THE FILE Open the HTML page in a Web browser to preview it. You should view your page in multiple Web browsers. Most likely it will not look exactly the same in every Web browser.

NEXT STEP…. . Learn some codes.