4.7. Introduction to HTML: basic structure, tags and attributes: Link tags (a)
Page 11 | Listen in audio
Chapter 4.7: Introduction to HTML: Basic structure, tags and attributes: Link tags (a)
HTML, which stands for HyperText Markup Language, is the standard markup language for creating web pages and applications. Along with CSS and JavaScript, HTML is one of the three main pillars of the World Wide Web.
Basic Structure of HTML
An HTML document has a specific structure that includes the following main parts:
- DOCTYPE: Indicates to the browser the version of HTML that the document is using.
- HTML element: This is the root element of an HTML page.
- Head element: Contains metainformation about the HTML document, such as its title and links to its scripts and CSS stylesheets.
- Body element: Contains the main content of the HTML document, such as text, images, videos, links, tables, lists and more.
HTML Tags
HTML tags are the foundation of any web page. They define and structure the content on a web page. Each HTML tag begins with a angle bracket (<) and ends with an angle bracket (>). Most HTML tags have an opening tag and a closing tag, with content in between.
HTML Attributes
HTML attributes are used to provide additional information about HTML elements. They are always specified at the beginning of the tag and are followed by an equals sign and a quoted value. For example, the link tag (a) usually has an 'href' attribute that indicates the URL the link points to.
Link tag (a)
The link tag (a) is used to create links in HTML. It is one of the most used tags in HTML and is essential for web navigation. The link tag has the following syntax:
<a href="URL">Link text</a>
Where 'URL' is the address of the web page you want to link to and 'Link Text' is the text that will be displayed as the link on the web page.
Link tag attributes (a)
The link tag (a) has several attributes that you can use to control its behavior. Here are some of the most common:
- href: This is the most important attribute of the link tag. It specifies the URL of the page the link should point to.
- target: This attribute specifies where to open the linked document. The "_blank" value will open the document in a new window or tab.
- download: This attribute instructs the browser to download the link instead of navigating to it.
- rel: This attribute specifies the relationship between the current page and the linked page.
In short, HTML is the basis of any web page. It provides the structure and content of a page, while CSS and JavaScript add style and functionality. The link tag (a) is an essential part of HTML, allowing navigation between pages and websites. Understanding the basic structure of HTML, its tags and attributes is critical to becoming an effective front-end developer.
Now answer the exercise about the content:
What is the function of the link tag in HTML and what are some of its most common attributes?
You are right! Congratulations, now go to the next page
You missed! Try again.
Next page of the Free Ebook: