HTML is used to create static web pages
CSS is used to control the style and layout of web pages
JavaScript provides dynamic behavior to web pages
Let’s understand the basic building blocks in HTML to create our web pages.
HTML documents must start with document type declaration:
Syntax:
A document type declaration (DOCTYPE) is an instruction to the web browser about the markup language which is being used to write current web page. It lets the browser know about the version of or standard of HTML or any other markup language that is being used in the document.
<!DOCTYPE html> <html> <body> <h1>TechLearnings Heading</h1> <p>TechLearnings Paragraph</p> </body> </html>
HTML headings are defined by to tags.
Heading levels are based upon importance.
defines the most important heading.
defines the least important heading.
<h1>Heading level 1</h1> <h2>Heading level 2</h2> <h3>Heading level 3</h3>
As mentioned above, JavaScript makes HTML pages more interactive and dynamic.
To embed JavaScript in HTML pages we use
tag.
- To write JavaScript statements for current web page
- To point external JavaScript file through src attribute inside script tag
<!DOCTYPE html> <script type="text/javascript"> document.getElementById("title").innerHTML = "Hello JavaScript!"; </script>
<script type="text/javascript" async="" src="https://www.example.com/external.js"></script>