Blog for Learning

This blog contains lesson material, material summary, questions and answers, definitions, types and examples, and others.


Powered by Blogger.


Flag Counter


15 HTML tags that do not have a closing pair

An element in HTML consists of opening tags and closing tags. However, there are also those who don't have closing tags.
Poor too, huh 😄
However, this element remains valid and can be read by the browser. Elements that do not have a closing tag are also called void elements , because they do not have contents.
What are the tags that don't have that cover?
let's see ...

1. Tag <area>

The <area>function tag is to define the area in the image map .Image map is an image that has a clickable area. Tags are <area>always inside tags <map>.
<img src="" width="145" height="126" alt="Planets" usemap="#planetmap">

<map name="planetmap">
  <area shape="rect" coords="0,0,82,126" alt="Sun" href="sun.htm">
  <area shape="circle" coords="90,58,3" alt="Mercury" href="mercur.htm">
  <area shape="circle" coords="124,58,8" alt="Venus" href="venus.htm">
The demo can be seen at:

2. Tag <base>

The <base>function tag is to create the base URL and target for a relative link. Example of its use:
<!DOCTYPE html>
  <base href="" target="_blank">

<p><img src="stickman.gif" width="24" height="39" alt="Stickman"> - Notice that we have only specified a relative address for the image. Since we have specified a base URL in the head section, the browser will look for the image at "".</p>

<p><a href="">W3Schools</a> - Notice that the link opens in a new window, even if it has no target="_blank" attribute. This is because the target attribute of the base element is set to "_blank".</p>

Note the example above, the image stickman.gifwill be searched at the base URL address given in the tag <base>Then, the W3Schools link will open in a new window, because the <base>target tag is already set.

3. Tag <br>

This tag functions to create a new line. Example of its use:
    Langit seolah-olah menangis.<br>
    Hujan waktu itu sangat berkesan.
the result:
The sky as if crying. 
The rain was very memorable at that time.

4. Tag <col>

The <col>function tag is to give attributes to columns in the table. This tag is written in the tag <colgroup>With <col>this tag , we do not have to create attributes for each table cell ( <td>), because it is already represented by it.
Example of use:
    <col span="2" style="background-color:red">
    <col style="background-color:yellow">
    <td>My first HTML</td>
    <td>My first CSS</td>

5. Tag <embed>

The <embed>function tag is to create containers for external applications or interactive content such as flash animation.
Example of use:
<!DOCTYPE html>

<embed src="helloworld.swf">


6. Tag <hr>

Tag <hr>function to create a horizontal line (horizontal row) . Example of its use:
<h4>Waktu itu...</h4>
<p>Tak kusangka, hari itu bakal menjadi hari terakhirku berjumpa denganmu</p>

The result:

That time…

I never thought, that day would be my last day to meet you

7. Tag <img>

This one tag must have known many functions. Yep ... really right. its function to display images.
Example of use:
<img src="foto-si-doi.jpg">

8. Tag <input>

The <input>function tag is to make input elements on the form. This tag has an attribute typethat will determine the type of input.
<form action="proses.php" method="POST">
    <input type="text" name="username" placeholder="Username">
    <input type="password" name="password" placeholder="Password">
    <input type="submit" value="Masuk">

9. Tag <keygen>

The <keygen>function tag is to create a secret key on the form. This tag is used for security.
Example of use:
<form action="/action_page.php" method="get">
  Username: <input type="text" name="usr_name">
  Encryption: <keygen name="security">
  <input type="submit">
Tags are <link>used to define the relationship between HTML documents and external resources such as CSS. This tag can also be used to create a favicon .
Example of use:
    <link rel="stylesheet" href="/css/style.css">
    <link rel="icon" href="favicon.png">

11. Tag <meta>

Tags are <meta>used to define the metadata of a web page.Metadata will not be displayed on a web page, but will be read by a machine or a bot (robot). For example, data will appear on search engines.
Display of meta tags on Google
<meta>This tag is important for SEO (search engine optimization) . So, if you create a web without using tags <meta>, it's likely to be difficult to be indexed by search engines.
Examples of tag usage <meta>:
  <meta charset="UTF-8">
  <meta name="description" content="Web Programmer pengguna Linux">
  <meta name="keywords" content="Programmer,Linux,Petanikode,Petani Kode">
  <meta name="author" content="Petani Kode">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">

12. Tag <param>

Tags are <param>used to give parameters to embeded plug-insusing elements <object>.
<object data="horse.wav">
  <param name="autoplay" value="true">

13. Tag <source>

Tags are <source>used to define media file sources for <audio>and <video>.
<audio controls>
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
  Browser anda tidak mendukung elemen audio.

14. Tag <track>

Tags are <track>used to define taks for media elements ( <audio> and <video>). Can be in the form of subtitles , captions, and other texts.
Example of use:
<video width="320" height="240" controls>
  <source src="forrest_gump.mp4" type="video/mp4">
  <source src="forrest_gump.ogg" type="video/ogg">
  <track src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English">
  <track src="subtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">

15. Tag <wbr>

WBR stands for Word Break Opportunity . This tag is almost similar to the tag <br>The difference, this tag does not directly create a new line like <br>.
This tag will create a new line when there is no space on the side.
Example of use:
To learn AJAX, you must be familiar with the XML<wbr>Http<wbr>Request Object.
Then later, if the screen size is narrowed, text will be displayed like this:
To learn AJAX, you must be familiar with the XML
Request Object.
That's 15 HTML tags that don't have a closing pair. Then how do you close these tags, while they don't have a closing partner?
In XHTML, all elements must be closed. Well! to close these tags, we can use slashes ( /) at the end.
<br />
<hr />
0 Komentar untuk "15 HTML tags that do not have a closing pair"

Silahkan berkomentar sesuai artikel

Template By Kunci Dunia
Back To Top