Blog for Learning

| lesson material | material summary | questions and answers | definitions | types and examples | other information | materi pelajaran | ringkasan materi | pertanyaan dan jawaban | definisi | jenis-jenis dan contoh-contoh | informasi lainnya |

Powered by Blogger.

Pages

What do tags, elements, and attributes mean in HTML?


Tags, elements, and attributes are three basic things that you must understand when learning HTML. Because of the three basic things that make up an HTML document. Let's discuss them one by one.

What is a tag?

Tag, we can say as a marker. The prefix and ending of an element. The tag is enclosed in square brackets (<...>). Example: <p></a><body><head>, and so on. HTML tags consist of opening tags and closing tags. The closing tag, typically there is a slash in front of the tag name, for example: </p></i></div>, etc. While the opening tag does not have a slash. So, the opening tag pair and closing tag will form an element. 
enter image description here

Don't forget to always close the HTML tag. Although there is also an HTML tag that does not have a partner such as <hr><br><img><link><input>etc. However, we can close it by adding a slash after the tag name, for example: <hr/><br/><img/>,<link/>, etc. Even though it doesn't have slashes, the tag remains valid, but not in XHTML (XML + HTML).

What is an element?

The HTML code from the opening tag to the closing tag, is called one element. HTML elements can be nested . That is, elements can be inside elements. Example:
<head>
    <title>Petani Kode</title>
</head>
 In the example above, the title element is inside the headelement Elements that cannot be nested are elements that do not have a closing tag. Because elements that do not have a pair of covers cannot be the parent of another element. 

If the element is drawn in a square, it will look like the following picture:
Structure of nested HTML elements

What are attributes?

Attributes are parts of elements that complement these elements. When likened to a school uniform, the attributes are tie, belt, hat, nameplate, and so on. These attributes have characteristics or values. For example, black belts, blue ties, white uniforms, and so on. Likewise with attributes in HTML. We can create attributes in any element. The location of writing attributes is in the opening tag. Writing format nama-atribut=“nilainya”You can attach attribute values ​​with double or single quotes. Example:
<a href=’http://petanikode.com'>Petanikode.com</a>
In the example above, there is an attribute hrefThe href attribute serves to determine the address of the link on the element a (hyperlink) .

Conclusion

Tags are markers that indicate the start and end of an HTML element. Attributes are complementary to an element. Tags, elements, and attributes are the three elements that make up an HTML document. 


How do you think? Additional?

Reference: https://www.petanikode.com/html-tag-elemen-atribut/
0 Komentar untuk "What do tags, elements, and attributes mean in HTML?"

Silahkan berkomentar sesuai artikel

 
Template By Kunci Dunia
Back To Top