Skip to content

Instantly share code, notes, and snippets.

@dimaanj
Last active December 25, 2024 08:55
Show Gist options
  • Save dimaanj/6bb89954de124f450acc11a69c83e7a0 to your computer and use it in GitHub Desktop.
Save dimaanj/6bb89954de124f450acc11a69c83e7a0 to your computer and use it in GitHub Desktop.
Inline vs inline-block
<p>
I am a paragraph and this is a <span>span</span> inside that paragraph. A span
is an inline element and so does not respect width and height.
</p>
body {
font-family: sans-serif;
}
p {
border: 2px solid rebeccapurple;
width: 200px;
}
span {
/* inlne-block consider height, width, vertical padding and margin */
/* display: inline-block; */
margin: 20px;
padding: 20px;
width: 80px;
height: 150px;
background-color: lightblue;
border: 2px solid blue;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment