HTML Block and Inline Elements

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

HTML Block and Inline Elements

Page 1 of 7

w3schools.com

THE WORLD'S LARGEST WEB DEVELOPER SITE

HTML

CSS

TUTORIALS

Professional email.
For the business you built.

HTML Block and Inline Elements


Previous

Gmail for Work

Next Chapter

Every HTML element has a default display value depending on what type of
element it is. The default display value for most elements is block or inline.

Block-level Elements

A block-level element always starts on a new line and takes up the full width
available (stretches out to the left and right as far as it can).
The <div> element is a block-level element.
Examples of block-level elements:

<div>
<h1> - <h6>
<p>
<form>

Inline Elements

http://www.w3schools.com/html/html_blocks.asp

02-08-2016

HTML Block and Inline Elements

Page 2 of 7

An inline element does not start on a new line and only takes up as much width as
necessary.
This is an inline <span> element inside a paragraph.
Examples of inline elements:
<span>
<a>
<img>

The <div> Element

The <div> element is often used as a container for other HTML elements.
The <div> element has no required attributes, but both style and class are
common.
When used together with CSS, the <div> element can be used to style blocks of
content:

Example
<div style="background-color:black;color:white;padding:20px;">
<h2>London</h2>
<p>London is the capital city of England. It is the most
populous city in the United Kingdom, with a metropolitan area of
over 13 million inhabitants.</p>
</div>
Try it Yourself

The <span> Element

The <span> element is often used as a container for some text.

http://www.w3schools.com/html/html_blocks.asp

02-08-2016

HTML Block and Inline Elements

Page 3 of 7

The <span> element has no required attributes, but both style and class are
common.
When used together with CSS, the <span> element can be used to style parts of
the text:

Example
<h1>My <span style="color:red">Important</span> Heading</h1>
Try it Yourself

HTML Grouping Tags


Tag

Description

<div>

Defines a section in a document (block-level)

<span>

Defines a section in a document (inline)

Previous

http://www.w3schools.com/html/html_blocks.asp

Next Chapter

02-08-2016

HTML Block and Inline Elements

Page 4 of 7

Put Ads on
your blog
with
Adsense

LEARN MORE

COLOR PICKER

LEARN MORE

HTML Cards
Google Maps
Animated Buttons

http://www.w3schools.com/html/html_blocks.asp

02-08-2016

HTML Block and Inline Elements

Page 5 of 7
Modal Boxes
Modal Images
Tooltips
Loaders
Filter List

JS Animations
Progress Bars
Dropdowns

Slideshow
Side Navigation
Top Navigation
HTML Includes

SHARE

CERTIFICATES

HTML, CSS, JavaScript, PHP, jQuery, Bootstrap and XML.


Read More

http://www.w3schools.com/html/html_blocks.asp

02-08-2016

HTML Block and Inline Elements

Page 6 of 7

REPORT ERROR
PRINT PAGE
FORUM
ABOUT

Top 10 Tutorials
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
W3.CSS Tutorial
Bootstrap Tutorial
SQL Tutorial
PHP Tutorial
jQuery Tutorial
Angular Tutorial
XML Tutorial

Top 10 References
HTML Reference
CSS Reference
JavaScript Reference
W3.CSS Reference
Browser Statistics
PHP Reference
HTML Colors
HTML Character Sets

http://www.w3schools.com/html/html_blocks.asp

02-08-2016

HTML Block and Inline Elements

Page 7 of 7
jQuery Reference

AngularJS Reference

Top 10 Examples
HTML Examples
CSS Examples

JavaScript Examples
W3.CSS Examples
HTML DOM Examples
PHP Examples
ASP Examples
jQuery Examples
Angular Examples
XML Examples

Web Certificates
HTML Certificate
HTML5 Certificate
CSS Certificate
JavaScript Certificate
jQuery Certificate
PHP Certificate
Bootstrap Certificate
XML Certificate

W3Schools is optimized for learning, testing, and training. Examples might be simplified to improve
reading and basic understanding. Tutorials, references, and examples are constantly reviewed to avoid
errors, but we cannot warrant full correctness of all content. While using this site, you agree to have
read and accepted our terms of use, cookie and privacy policy. Copyright 1999-2016 by Refsnes Data. All
Rights Reserved.
Powered by W3.CSS.

http://www.w3schools.com/html/html_blocks.asp

02-08-2016

You might also like