Holla Tech-Learn

Types of Elements
 

In HTML, most elements are defined as block level or inline elements.
Block level elements start from a new line.
For example: <h1>, <form>, <li>, <ol>, <ul>, <p>, <pre>, <table>, <div>, etc.

Inline elements are normally displayed without line breaks.
For example: <b>, <a>, <strong>, <img>, <input>, <em>, <span>, etc.

The <div> element is a block-level element that is often used as a container for other HTML elements.
When used together with some CSS styling, the <div> element can be used to style blocks of content:

<html>
  <body>
    <h1>Headline</h1>
    <div style=background-color:green; color:white; padding:20px;>
      <p>Some paragraph text goes here.</p>
      <p>Another paragraph goes here.</p>
    </div>
  </body>
</html>

 

Holla Tech - Learn HTML

Similarly, the <span> element is an inline element that is often used as a container for some text.
When used together with CSS, the <span> element can be used to style parts of the text

<html>
  <body>
    <h2>Some
      <span style=color:red>Important</span>
    Message</h2>
  </body>
</html>

 

HOLLA TECH - LEARN HTML


 

SUMMARY:
The <div> element defines a block-level section in a document. The <span> element defines an inline section in a document.
 


Types Of Elements
 

Other elements can be used either as block level elements or inline elements. This includes the following elements:
APPLET – embedded Java applet
IFRAME – Inline frame
INS – inserted text
MAP – image  map
OBJECT – embedded object
SCRIPT – script within an HTML document

You can insert inline elements inside block elements. For example, you can have multiple <span> elements inside a <div> element.

NOTE!
Inline elements cannot contain any block level elements.

 

BACK NEXT

CLICK ON THE BUTTON BELOW TO GO TO THE HTML MAIN COURSE PAGE. 

HTML MAIN COURSE PAGE

 


© License: All Rights Reserved 


CONTACT HOLLA TECH – LEARN SUPPORT