Elements

An HTML element is a basic building block of web pages, defined by a start tag, content, and an end tag. For example, in <p>Hello, world!</p>, <p> is the start tag, "Hello, world!" is the content, and </p> is the end tag. HTML elements structure the content and layout of a webpage, enabling browsers to display text, images, links, and other media correctly

HTML Element


Case Sensitivity


HTML is not case-sensitive, meaning that tags and attribute names can be written in either uppercase or lowercase, or a mix of both. For example, <div>, <DIV>, and <Div> are all interpreted the same way by the browser. However, the convention is to write HTML tags in lowercase to maintain consistency and readability.

Example
<!DOCTYPE html>
<HTml>
<BODY>
<P>
HTML is not case sensitive i.e we can
use both upper or, lower case letters
in the tags.
</p>
</BOdy>
</html>

Try it yourself


Self closing tag


In HTML, self-closing tags are elements that do not require a closing tag because they do not have any content. These tags are used to insert elements like images, line breaks, or horizontal rules into a webpage. In HTML5, self-closing tags do not require a trailing slash, though it can still be included for compatibility reasons.

Here are a few examples:

  1. Image: <img src="image.jpg" alt="description">
  2. Line break: <br>
  3. Horizontal rule: <hr>
  4. Input field: <input type="text">
Example
<!DOCTYPE html>
<img src="/assets/images/whereisstuff.png" alt="whereisstuff.com" width="100" height="100"/>
<hr>
<br/>
<input type="text">

Try it yourself


Block level element


A block-level element in HTML is an element that takes up the full width of its container, creating a "block" on the page. This means it starts on a new line and pushes any following content down. Examples of block-level elements include <div>, <p>, <h1> through <h6>, and <section>.

Example
<div>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
</div>

Try it yourself


Inline element


An inline element in HTML is an element that only takes up as much width as necessary, and it doesn't start on a new line. It flows within the content of a block-level element. A simple example of an inline element is the <span>,<em>,<strong> tag:

Example
<p>This is a <span style="color: green;">Whereisstuff</span> word in a paragraph.</p>

Try it yourself


Whereisstuff is simple learing platform for beginer to advance level to improve there skills in technologies.we will provide all material free of cost.you can write a code in runkit workspace and we provide some extrac features also, you agree to have read and accepted our terms of use, cookie and privacy policy.
© Copyright 2024 www.whereisstuff.com. All rights reserved. Developed by whereisstuff Tech.