Last active
December 25, 2024 08:55
-
-
Save dimaanj/6bb89954de124f450acc11a69c83e7a0 to your computer and use it in GitHub Desktop.
Inline vs inline-block
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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