4.28. Introduction to HTML: basic structure, tags and attributes: Objects and arrays

Página 32

4.28. Introduction to HTML: basic structure, tags and attributes: Objects and arrays

Introduction to HTML: basic structure, tags and attributes

HTML, which stands for Hyper Text Markup Language, is the standard markup language for creating web pages. With HTML, you can create your own website structure, using different tags and attributes.

Basic Structure of HTML

The basic structure of an HTML page consists of three main parts: the <head> element, the <body> element, and the < element ;html>. The <html> element is the root of an HTML page. All other HTML elements must be descendants of this element.

    <!DOCTYPE html>
    <html>
    <head>
    <title>Page Title</title>
    </head>
    <body>
    The body of the page...
    </body>
    </html>
    

HTML Tags

HTML tags are the foundation of any web page. They define and structure the content on a web page and are used to create HTML elements such as headings, paragraphs, lists, links, images, and more.

An HTML tag consists of a tag name, enclosed in angle brackets. An HTML tag typically comes in pairs, with an opening tag and a closing tag.

    <p>This is an example of a paragraph tag in HTML.</p>
    

HTML Attributes

HTML attributes are used to provide additional information about HTML elements. They are always specified in the opening tag and usually come in name/value pairs.

For example, the <a> tag (which creates a link) has an attribute called "href" that specifies where the link should go:

    <a href="https://www.example.com">This is a link</a>
    

Introduction to Objects and Arrays in JavaScript

Objects

In JavaScript, an object is a collection of properties, and a property is an association between a name (or key) and a value. A property value can be a function, which is then considered a method of the object.

    var person = {
    name: "John",
    age: 30,
    city: "New York"
    };
    

Arrays

An array is a special global object, which is an ordered list of values. In JavaScript, arrays start with an index of 0.

    var fruits = ["Apple", "Banana", "Strawberry", "Orange", "Lemon"];
    

We hope this introduction to HTML and JavaScript has been helpful and provided you with a basic understanding of how these technologies work. In the next chapter, we will explore CSS in more depth and how it is used to style web pages.

Now answer the exercise about the content:

What does HTML mean and what is its purpose?

You are right! Congratulations, now go to the next page

You missed! Try again.

Next page of the Free Ebook:

334.29. Introduction to HTML: basic structure, tags and attributes: DOM manipulation

Earn your Certificate for this Course for Free! by downloading the Cursa app and reading the ebook there. Available on Google Play or App Store!

Get it on Google Play Get it on App Store

+ 6.5 million
students

Free and Valid
Certificate with QR Code

48 thousand free
exercises

4.8/5 rating in
app stores

Free courses in
video, audio and text