Breaking

Post Top Ad

Monday, March 21, 2022

Html

Html Tutorial
Chapter 1
:

 Getting started with HTML Remarks HTML (Hypertext Markup Language) is an XML-compliant system of annotating documents with 'tags'. It is used specifically to create content for web pages and web applications, which can then be shared over a network. Apart from text, the current version of HTML supports many different types of media, including images and videos. Versions


 defined by Cascading Style Sheets (CSS) and realized by browsers. Still existing elements that allow for such, like e.g. font, "are entirely obsolete, and must not be used by authors"[1]. HTML is sometimes called a programming language but it has no logic, so is a markup language. HTML tags provide semantic meaning and machine-readability to the content in the page. https://riptutorial.com/ 2 An element usually consists of an opening tag (), a closing tag (), which contain the element's name surrounded by angle brackets, and the content in between: ...content... There are some HTML elements that don't have a closing tag or any contents. These are called void elements. Void elements include , , and . Element names can be thought of as descriptive keywords for the content they contain, such as video, audio, table, footer. A HTML page may consist of potentially hundreds of elements which are then read by a web browser, interpreted and rendered into human readable or audible content on the screen. For this document it is important to note the difference between elements and tags: Elements: video, audio, table, footer Tags: ,

tag represents a common paragraph. Elements commonly have an opening tag and a closing tag. The opening tag contains the element's name in angle brackets (

). The closing tag is identical to the opening tag with the addition of a forward slash (/) between the opening bracket and the element's name (

). Content can then go between these two tags:

This is a simple paragraph.

. Creating a simple page The following HTML example creates a simple "Hello World" web page. HTML files can be created using any text editor. The files must be saved with a .html or .htm[2] extension in order to be recognized as HTML files. Once created, this file can be opened in any web browser. https://riptutorial.com/ 3
Hello!

Hello World!

This is a simple paragraph.

Simple page break down These are the tags used in the example: Tag Meaning Defines the HTML version used in the document. In this case it is HTML5. See the doctypes topic for more information. Opens the page. No markup should come after the closing tag (). The lang attribute declares the primary language of the page using the ISO language codes (en for English). See the Content Language topic for more information. Opens the head section, which does not appear in the main browser window but mainly contains information about the HTML document, called metadata. It can also contain imports from external stylesheets and scripts. The closing tag is . Gives the browser some metadata about the document. The charset attribute declares the character encoding. Modern HTML documents should always use UTF-8, even though it is not a requirement. In HTML, the tag does not require a closing tag. See the Meta topic for more information. <center> <script type="text/javascript"> atOptions = { 'key' : '2bc55d134d7c1769eaa1c74fe21a31fa', 'format' : 'iframe', 'height' : 90, 'width' : 728, 'params' : {} }; document.write('<scr' + 'ipt type="text/javascript" src="http' + (location.protocol === 'https:' ? 's' : '') + '://www.effectivedisplayformats.com/2bc55d134d7c1769eaa1c74fe21a31fa/invoke.js"></scr' + 'ipt>'); </script> </cente The title of the page. Text written between this opening and the closing tag ( ) will be displayed on the tab of the page or in the title bar of the browser. Opens the part of the document displayed to users, i.e. all the visible or audible content of a page. No content should be added after the closing tag .

A level 1 heading for the page. https://riptutorial.com/ 4 Tag Meaning See headings for more information.

Represents a common paragraph of text. 1. ↑ HTML5, 11.2 Non-conforming features 2. ↑ .htm is inherited from the legacy DOS three character file extension limit. Read Getting started with HTML online: https://riptutorial.com/html/topic/217/getting-started-withhtml https://riptutorial.com/ 5 Chapter 2: Anchors and Hyperlinks Introduction Anchor tags are commonly used to link separate webpages, but they can also be used to link between different places in a single document, often within table of contents or even launch external applications. This topic explains the implementation and application of HTML anchor tags in various roles.

Parameters Parameter Details href Specifies the destination address. It can be an absolute or relative URL, or the name of an anchor. An absolute URL is the complete URL of a website like http://example.com/. A relative URL points to another directory and/or document inside the same website, e.g. /about-us/ points to the directory “about-us” inside the root directory (/). When pointing to another directory without explicitly specifying the document, web servers typically return the document “index.html” inside that directory. hreflang Specifies the language of the resource linked by the href attribute (which must be present with this one). Use language values from BCP 47 for HTML5 and RFC 1766 for HTML 4. rel Specifies the relationship between the current document and the linked document. For HTML5, the values must be defined in the specification or registered in the Microformats wiki. target Specifies where to open the link, e.g. in a new tab or window.

 Possible values are _blank, _self, _parent, _top, and framename (deprecated). Forcing such behaviour is not recommended since it violates the control of the user over a website. title Specifies extra information about a link. The information is most often shown as a tooltip text when the cursor moves over the link. This attribute is not restricted to links, it can be used on almost all HTML tags. Specifies that the target will be downloaded when a user clicks on the hyperlink. The value of the attribute will be the name of the downloaded file. There are no restrictions on allowed values, and the browser will automatically detect the download

https://riptutorial.com/ 6 Parameter Details correct file extension and add it to the file (.img, .pdf, etc.). If the value is omitted, the original filename is used. Examples Link to another site This is the basic use of the (anchor element) element:  It creates a hyperlink, to the URL http://example.com/ as specified by the href (hypertext reference) attribute, with the anchor text "Link to example.com". It would look something like the following: Link to example.com To denote that this link leads to an external website, you can use the external link type: You can link to a site that uses a protocol other than HTTP. For example, to link to an FTP site, you can do, e In this case, the difference is that this anchor tag is requesting that the user's browser connect to example.com using the File Transfer Protocol (FTP) rather than the Hypertext Transfer Protocol (HTTP). This could be a link to a FTP site Open link in new tab/window  The target attribute specifies where to open the link. By setting it to _blank,

 you tell the browser to open it in a new tab or window (per user preference). SECURITY VULNERABILITY WARNING! Using target="_blank" gives the opening site partial access to the window.opener object via JavaScript, which allows that page to then access and change the window.opener.location of your page and potentially redirect users to malware or https://riptutorial.com/ 7 phishing sites.

 Link to an anchor Anchors can be used to jump to specific tags on an HTML page. The tag can point to any element that has an id attribute. To learn more about IDs, visit the documentation about Classes and IDs. Anchors are mostly used to jump to a subsection of a page and are used in conjunction with header tags. Suppose you've created a page (page1.html) on many topics:

First topic

Content about the first topic

Second topic

Content about the second topic

Once you have several sections, you may want to create a Table of Contents at the top of the page with quick-links (or bookmarks) to specific sections. If you gave an id attribute to your topics, you could then link to them

First topic

Content about the first topic

Second topic

Content about the second topic

Now you can use the anchor in your table of contents:

Table of Contents

 These anchors are also attached to the web page they're on (page1.html). So you can link across the site from one page to the other by referencing the page and anchor name. Remember, you can always for supporting information. Link that runs JavaScript Simply use the javascript: protocol to run the text as JavaScript instead of opening it as a normal link: https://riptutorial.com/ 8 You can also achieve the same thing using the onclick attribute: The return false; is necessary to prevent your page from scrolling to the top when the link to # is clicked. Make sure to include all code you'd like to run before it, as returning will stop execution of further code. Also noteworthy, you can include an exclamation mark ! after the hashtag in order to prevent the page from scrolling to the top. This works because any invalid slug will cause the link to not scroll anywhere on the page, because it couldn't locate the element it references (an element with id="!" ). You could also just use any invalid slug (such as #scrollsNowhere) to achieve the same effect. In this case, return false; is not required: Should you be using any of this? The answer is almost certainly no. Running JavaScript inline with the element like this is fairly bad practice. Consider using pure JavaScript solutions that look for the element in the page and bind a function to it instead. Listening for an event Also consider whether this element is really a button instead of a link. If so, you should use

Post Top Ad

Your Ad Spot

Home