DEV Community

Cover image for Scoping in HTML
Saami abbas Khan
Saami abbas Khan

Posted on

Scoping in HTML

This is a submission for the Web Game Challenge: One Byte Explainer

Explainer

In HTML, there are two types of elements: block and inline. Block elements (e.g. <div>) cover the entire line, while inline elements (e.g., <span>) occupy only the necessary space. A block element can't be wrapped inside an inline element like <span>.

Additional Context

If we wrap a <div> (a block element) with a <span> tag, it will behave unexpectedly. For example, applying a background color to that <span> element will only partially work. Remember to always wrap inline elements (like ) with block elements (like ), not the other way around.

@saamiabbaskhan

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Cloudinary image

Zoom pan, gen fill, restore, overlay, upscale, crop, resize...

Chain advanced transformations through a set of image and video APIs while optimizing assets by 90%.

Explore

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay