Compare the Difference Between Similar Terms

Difference Between

Home / Technology / IT / Programming /Difference Between div and span

Difference Between div and span

February 15, 2018Posted byLithmee

KeyDifference – divvsspan

HTML是一种广泛使用的语言来开发web页面。它stands for Hyper Text Markup Language. The term Hyper refers to linking to other web resources on the internet. The term Markup refers to the ability to create formatted text with images and other multimedia resources. Hyperlinks are the main components in HTML that make all web resources connect together. There are several versions of HTML. They are HTML 2.0, 3.2, 4.01 andHTML5. Basically, HTML is a text document with tags. It tells the Web browser the way to structure the web page to display it. The div and span are two tags in HTML. Each HTML element has a default display value depending on the type of the element. So, they can be a block or inline elements. This article discusses the difference between div and span. Thekey differencebetween div and span is thatdiv is a block level element while span is an inline element.

CONTENTS

1.Overview and Key Difference
2.What is div
3.What is span
4.Similarities Between div and span
5.Side by Side Comparison – div vs span in Tabular Form
6.Summary

What is div?

All html documents start with a document type declaration. Today the most common version of HTML is HTML5. Therefore, the type declaration is . All html tags should be included inside the and tags. The necessary details of the web page are included inside the tag. The visible web page is written inside the tag. There are tags for each purpose. The

tag is used to paragraphs. The

,

etc. are used for headings. The content inside the starting and ending tag is known as an element. e.g.

This is a paragraph

.

Difference Between div and span

Figure 01: HTML5

Each HTML element has a default display value depending on the type of the element. The default display values can either be block or inline. The block level elements always start with a new line. These elements take whole available width. Some examples of block level elements are

,

,
and .

The div tag is also a block level element in HTML. The syntax is as follows.

Hello World!

The div elements is a container to other elements. Therefore, a set of elements can be packed into the div element. When used with Cascading Style Sheet (CSS), div tag can be used to style a block of content. Refer the below piece of code.

Difference Between div and span_Figure 03

Two paragraphs are inside the div tag. All the content inside the div tag has the background color black and the font color white.

What is span?

Unlike in block level elements, the inline elements do not start on a new line. It only takes the required width. Some examples of inline elements are

div vs span

The div is an HTML tag that defines a division or a section in a HTML document. The span is an HTML tag that is used to group inline elements in a HTML document.
Usage
The div tag is used as a container for other elements. The span tag is used as a container for some text.
New Line
The div tag starts with a new line. The span tag does not start with a new line.
Required Width
The div tag will take all width. The span tag will only take the required width.
Syntax

Summary –divvsspan

HTML stands for Hyper Text Markup Language. It is used to develop websites. This language consists of tags. The div and span grouping tags in HTML. They are used to define a section in a document. This article explained the difference between div and span tags. The difference between div and span is that div is a block level element while span is an inline element.

Download the PDF of div vs span

You can download the PDF version of this article and use it for offline purposes as per citation note. Please download the PDF version here:Difference Between div and span

Reference:

1.tutorialspoint.com. “HTML Blocks.”The Point,Available here
2. htmL Block and Inline Elements.Available here

Image Courtesy:

1.’HTML5 logo and wordmark’By W3C,(CC BY 3.0)viaCommons Wikimedia

Related posts:

Difference Between Agile and Scrum Difference Between Echo and Print Difference Between Static and Non Static Method Difference Between Runnable and Thread_Figure 03Difference Between Runnable and Thread Difference Between Ruby and PythonDifference Between Ruby and Python

Filed Under:ProgrammingTagged With:Compare div and span,div,div and span Differences,div and span Similarities,div Definition,div New Line,div Syntax,div Usage,div vs span,span,span Definition,span New Line,span Syntax,span Usage

About the Author:Lithmee

Lithmee Mandula is a BEng (Hons) graduate in Computer Systems Engineering. She is currently pursuing a Master’s Degree in Computer Science. Her areas of interests in writing and research include programming, data science, and computer systems.

Leave a ReplyCancel reply

Your email address will not be published.Required fields are marked*

Request Article

Featured Posts

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and SARS

Difference Between Coronavirus and SARS

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Covid 19

Difference Between Coronavirus and Covid 19

You May Like

Difference Between Utility and Design Patent

Difference Between Pointer and Reference

Difference Between Pointer and Reference

Difference Between Manners and Behavior

Difference Between Free Nerve Endings and Encapsulated

Difference Between Free Nerve Endings and Encapsulated

Difference Between Male and Female Kangaroo

Difference Between Male and Female Kangaroo

Latest Posts

  • What is the Difference Between Solution Suspension and Emulsion
  • What is the Difference Between Constipation and Diarrhea
  • What is the Difference Between Soil Texture and Soil Structure
  • What is the Difference Between Appendicitis and Crohn’s Disease
  • What is the Difference Between Vacuum Pump and Compressor
  • What is the Difference Between Soil and Clay
  • Home
  • Vacancies
  • About
  • Request Article
  • Contact Us

Copyright © 2010-2018Difference Between. All rights reserved.Terms of Useand Privacy Policy:Legal.