MOCKSTACKS
EN
Questions And Answers

More Tutorials









HTML Head

The HTML <head> element is a container for the following elements:

<title> , <style> , <meta> , <link> , <script> , and <base>.


HTML <head> element

The <head> element is placed between the <html> tag and the <body> tag.

Html head

<html>
    <head>

    </head>
    <body>

    </body>
</html>

HTML <title> element

The <title> element defines the title of the document. The title must be text-only, and it is shown in the browser's title bar or in the page's tab.

Html title

<html>
    <head>
        <title> document </title>
    </head>
    <body>
    The content of the website here...
    </body>
</html>

HTML <style> element

The <style> element is used to define style information for a single HTML page:

Html style

<style>
   body { background-color: white; } 
   a { color: blue; } 
   div { margin: 10px; } 
</style>

HTML <link> element

The <link> element defines the relationship between the current document and an external resource.

Html link

<link rel="stylesheet" href="style.css">

HTML <meta> element

The <meta> element is typically used to specify the character set, page description, keywords, author of the document, and viewport settings.

The metadata will not be displayed on the page, but are used by browsers (how to display content or reload page), by search engines (keywords), and other web services.

The character set

<meta charset="UTF-8">

The keywords for search engines

<meta name="keywords" content="HTML, CSS, Javascript">

The description of your web page

<meta name="description" content="HTML documentation">

The author of page

<meta name="author" content="author name">

Refresh document every 30 seconds

<meta http-equiv="refresh" content="30">

Setting the viewport to make your website look good on all device

<meta name="viewport" content="width=device-width, initial-scale=1.0">

HTML <script> element

The <script> element is used to define client-side JavaScripts.

Html style

<script>
                        
   function myFunction(){
       document.getElementById("demo").innerHTML = "Hello Javascript!";
   }
   
</script>

HTML <base> element

The <base> element specifies the base URL and/or target for all relative URLs in a page.
There can only be one single <base> element in a document!

Html style

<head>
   < base href"https://mockstacks.com/website-output/" target_blank >
</head>


Conclusion

In this page (written and validated by ) you learned about HTML Head . What's Next? If you are interested in completing HTML tutorial, your next topic will be learning about: HTML computer code.



Incorrect info or code snippet? We take very seriously the accuracy of the information provided on our website. We also make sure to test all snippets and examples provided for each section. If you find any incorrect information, please send us an email about the issue: mockstacks@gmail.com.


Share On:


Mockstacks was launched to help beginners learn programming languages; the site is optimized with no Ads as, Ads might slow down the performance. We also don't track any personal information; we also don't collect any kind of data unless the user provided us a corrected information. Almost all examples have been tested. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. By using Mockstacks.com, you agree to have read and accepted our terms of use, cookies and privacy policy.