HTML Java

HTML Basics


HTML Documents

  • All HTML documents must start with a document type declaration: <!DOCTYPE html>.
  • The HTML document itself begins with <html> and ends with </html>.
  • The visible part of the HTML document is between <body> and </body>.

Example

<html>
<head>

  <title>Page Title</title>

</head>
<body>

  <h1>This is a heading</h1>
  <p>This is a paragraph</p>

</body>
</html>
Try it »

HTML Headings

  • HTML defines six levels of headings.
  • HTML headings are defined with the <h1> to <h6> tags.
  • <h1> defines the most important heading and <h6> defines the least important heading.

Example

<html>
<head>

  <title>Page Title</title>

</head>
<body>

   <h1>This is a heading</h1>
   <h2>This is a heading</h2>
   <h3>This is a heading</h3>
   <h4>This is a heading</h4>
   <h5>This is a heading</h5>
   <h6>This is a heading</h6>

</body>
</html>
Try it »


HTML Paragraph

  • HTML paragraphs are defined with the <p> tag.
  • <p> tag is used to write the paragraph statements in a webpage.

Example

<html>
<head>

  <title>Page Title</title>

</head>
<body>

   <p>This is the first paragraph</p>
   <p>This is the second paragraph</p>

</body>
</html>
Try it »


HTML Horizontal Line

  • The <hr> tag is used to break the page.
  • <hr> tag is an empty tag.
  • <hr> tag creates a horizontal line running from the left ot the right.

Example

<html>
<head>

  <title>Page Title</title>

</head>
<body>

   <h1>This is the heading</h1>
   <p>This is the first paragraph</p>
   <p>This is the second paragraph</p>
   <hr>
   <p>This is the first paragraph</p>
   <p>This is the second paragraph</p>

</body>
</html>
Try it »


HTML Links

  • A link is a connection from one web source to another.
  • Links are specified in HTML using the “a” tag.
  • Syntax: <a href="url">Text to be Displayed <a>

  • href: The href attribute is used to specify the destination address of the link used.
  • Attributes are used to provide additional information about HTML elements.
  • Text to be displayed: It is the visible part of the link.

Example

<html>
<head>

  <title>Page Title</title>

</head>
<body>

   <h2>How to add a link in HTML</h2>
   <p>Click on the following link:</p>
   <p>This is the second paragraph</p>
   <a href="https://www.codersarts.com/">Coders Arts</p>

</body>
</html>
Try it »


HTML Buttons

  • The button tag in HTML is used to define the clickable button.
  • It is usually used to submit the content.
  • The image and text content can be used inside <button> tag.
  • Syntax: <button type = "button"></button>

Example

<html>
<head>

  <title>Page Title</title>

</head>
<body>

   <h2>HTML Buttons</h2>
   <p>HTML buttons are defined with the button tag:</p>
   <button>Click Here</button>

</body>
</html>
Try it »