Content · Web Development · HTML

HTML HTML Whitespace Around Inline and Block Elements

Spaces around inline elements can change whether words touch or separate. Because ordinary whitespace collapses, where you put a real space in source still matters.

1 views Published Oct 19, 2026 Updated Oct 19, 2026 Admin

Spaces around inline elements can change whether words touch or separate. Because ordinary whitespace collapses, where you put a real space in source still matters.

What You Need to Know


Block elements have their own layout behavior; indentation in source does not create a page layout. Make the text readable before adding styling.

The goal is not to collect as many tags as possible. Pick the element that best describes what the content really is.

Example: See It in Action


Take a look at this small piece of HTML. You can use it in a practice document and change the text to make it your own.

<p>Hello <strong>there</strong>, welcome back!</p>
<p><span>Two</span><span>words</span> may touch.</p>
<p><span>Two</span> <span>words</span> have a space.</p>

Let’s Understand the Example


  • A p groups a paragraph of related text. Start another paragraph for a new thought.
  • Strong marks text as particularly important. It means more than simply making words bold.
  • Span groups a short piece of inline content without adding a new meaning by itself.

Look for the text “Hello” in the page. If the visible result surprises you, inspect the rendered elements to see what the browser actually built.

What Should You See?


The page should include “Hello”. If it looks different from what you expected, open developer tools and compare the source with the elements the browser created.

Try removing one piece of markup in a scratch copy, refresh the page, and compare the behavior. This is often the fastest way to understand what that piece contributes.

Try It Yourself


  1. Add and remove the space between Two and words in the example.
  2. Save your changes, open or refresh the page, and compare the result with the original example.
  3. Tell a friend what your change did. If you are not sure, undo it, refresh the page, and compare.

Common Beginner Mistakes


  • Removing the space between inline spans and then wondering why the words run together.
  • Avoid picking tags just for their default bold, italic or spaced appearance. Use CSS for presentation.

Key Takeaways


  • Spaces around inline elements can change whether words touch or separate.
  • A p groups a paragraph of related text. Start another paragraph for a new thought.
  • Block elements have their own layout behavior; indentation in source does not create a page layout. Make the text readable before adding styling.
Share this resourceSend this page to someone who may find it useful.