Inline-block vs. Block ElementsIn this article, we will discuss the differences between inline-block and block elements. These elements are used widely every day while designing a website. People normally get confused between these elements. So let's understand the differences to avoid such confusion. Block ElementsThe elements that begin on a new line are known as block elements. A block element takes up the full width of the content. Unlike inline, there exists a top and bottom margin for these elements. Block-level elements may only appear inside the body tag. Block-level elements create a larger structure than inline elements. Example of Block elements: <div>, <p>, <li>, <main>, <nav>, <ul>, <form>, <video>, <table>, <aside>, <article> are some of the inline tags. Example: Output: Inline-Block ElementsThe display value of inline-block works similarly to inline with one exception: the height and width of that element become modifiable. Example: Output: Differences between Block and Inline-block
Here is the output file using all the elements on one page: The code of the above web page: Next TopicDifference between |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India