- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between HTML tags <div> and <span>?
Both <div> and <span> is used to define parts of a web page. The <span> element shows the inline portion of a document. The <div> elements show a block-level portion of a document.
A div is a block-level element and a span is an inline element.
The div should be used to wrap sections of a document, while use spans to wrap small portions of text, images, etc.
Here’s an example:
<div>Demo Text, with <span>some other</span> text.</div>
The <div> element is used while creating CSS based layouts in html, whereas <span> element is used to stylize texts.
- Display <div> or <span> over image on :hover in HTML
- Difference between <ion-list> and <div class=“list”> in Ionic framework?
- How to horizontally center a <div> in another <div>?
- What is the correct way of using <br>, <br/>, or <br /> in HTML?
- What is difference between <button> vs. <input type="button" />?
- What are the >> and << operators in Python?
- Selects all <div> elements and all <p> elements with CSS
- What is the difference between the != and <> operators in Python?
- How do we style HTML elements using the span tag <span>?
- Selects all <p> elements inside <div> elements with CSS
- What is the difference between <jsp:forward page = ... > and response.sendRedirect(url)?
- What is the difference between static_cast<> and C style casting?
- What is the difference between NA and <NA> in R?
- How to create a valid HTML document with no <html><body> and <head> element?