In: Computer Science
What does the HTML tag designate in an HTML document?
HTML tags are hidden keywords that define how the web browser must format and display contents into a web page. Most tags have two parts: an opening and a closing part. There are a list of tags used in HTML.
1. New paragraph
The <p> tag is used to define a paragraph in HTML. Most browsers will display text even if you forget to close the paragraph tag.
The usage of <p> tag:
<p> ... </p>
Executable code:
<! DOCTYPE html>
<html>
<head> </head>
<body>
<p> This is a sample paragraph </p>
</body>
</html>
2. Personal Data
The <details> tag is used to specify additional details that the user can view or hide accordingly.
The usage of <details> tag:
<details>
<summary> ... </summary>
<p> ... </p>
</details>
Executable code:
<! DOCTYPE html>
<html>
<head> </head>
<body>
<details open>
<summary> Personal details </summary>
<p> the personal data is visible in the web site </p>
</details>
3. Print command
The print() method prints the contents of the current window.
The usage of print() method:
<script>
windows.print();
</script>
Executable code:
<! DOCTYPE html>
<html>
<head> </head>
<body>
<button onclick = "myfunction()">Print</button>
<script>
function myfunction(){
windows.print();
}
</script>
</body>
</html>
4. Show photo
The <img> tag is empty and does not have closing tag. It contains only attributes.
The src specifies the url of the image. You can use the image name (for saved images) or the complete url.
The usage of <img> tag:
<img src = "image1.jpg">
Executable code:
<! DOCTYPE html>
<html>
<head> </head>
<body>
<img src="image1.jpg">
</body>
</html>