4.1. Introduction to HTML: basic structure, tags and attributes: Introduction to HTML
Page 5 | Listen in audio
Introduction to HTML
HTML (HyperText Markup Language) is the main language for creating websites and web applications. It is not a programming language, but a markup language. HTML allows you to structure your web page, add content, and make text display how you want. It is the backbone of any website and is an essential skill for any front-end developer.
Basic structure of HTML
A basic HTML document has a specific structure that includes the following parts:
- Doctype: The first line of any HTML document is the doctype declaration. It tells the browser what type of document to expect. In HTML5, the doctype declaration is very simple: ``.
- HTML Element: The HTML element is the root element of an HTML page. All other elements must be descendants of this element.
- Head Element: The head element contains metadata (data about the data) that is not displayed on the web page itself, but is machine readable. It typically contains the page title and links to scripts and stylesheets.
- Body Element: The body element contains the main content of the web page, which is displayed in the browser.
HTML Tags
HTML tags are the main syntax of HTML. They are used to create HTML elements and consist of a tag name surrounded by angle brackets. HTML tags come in pairs, which consist of an opening tag and a closing tag.
For example, here is a paragraph tag: `
This is a paragraph.
`. The opening tag is `` and the closing tag is `
`. The content inside the tags is the content of the element.HTML Attributes
HTML attributes are used to add additional information to HTML elements. They come in name-value pairs and are placed inside the opening tag of an element.
For example, here is an image element with a src attribute: ``. The attribute name is "src" and the attribute value is "image.jpg". This attribute tells the browser where to find the image that should be displayed.
Conclusion
This is a basic introduction to HTML. Learning HTML is the first step towards becoming a web developer. However, HTML is just the tip of the iceberg. To create interactive and dynamic websites, you will also need to learn CSS and JavaScript. But don't worry, we'll cover these topics in detail in the next chapters.
Now answer the exercise about the content:
What is the function of the "src" attribute in an HTML image tag?
You are right! Congratulations, now go to the next page
You missed! Try again.
Next page of the Free Ebook: