Tutorials

KodeKite Tools

HTML
Flexbox
SVG
Canvas
HTML Tutorial

More


HTML Blocks
Blocks

In HTML there are two type of elements.


  • Block Elements
  • Inline Elements
Block Elements

Block elements are block level elements with auto break line or new line. Block level elements includes headings, paragraph, prserve, div elements and these elements always starts on new line

Syntax

<div>Content</div>


You can use block elements any where within an HTML document.


Example

div Element 1
div Element 2 started on new line
Inline Elements

Span element is a inline element and it always starts inline, it does not starts on new line.

Syntax

<span>Content</span>


You can use span element any where within an HTML document.


Example

Span Element 1 Span Element 2 started inline with span element 1

Div and Span are pair tags, output of div element is block level and output of span element is inline.


Practice Task

Open notepad or any other text editor, follow the following points.


  • Create a box using div element
  • Assign class box to div element
  • Give width and height of 100px 100px to box
  • Give ornage background color to box
  • Write one span elment
  • Assign text a little box to span element

save file with name task.html or task.htm and then open it using any browser and see results.


Solution

A little box

Don't forget div and span are non empty element which means it always comes in pair.