HTML can classify elements into three types: inline elements, block elements, and inline-block elements. These types can be converted to each other using the display property in CSS.
<span>Inline Element 1</span><!-- Displayed in a line --><span>Inline Element 2</span><!-- Displayed in a line --><span>Inline Element 3</span><!-- Displayed in a line --><styletype="text/css">span{width: 1000px;/* Width has no effect */height: 1000px;/* Height has no effect */color: #333;background: #eee;padding: 100px 20px;/* Padding is effective in the horizontal direction and has a visual effect in the vertical direction, but it does not affect other elements */margin: 100px 20px;/* Margin is effective in the horizontal direction but not in the vertical direction */}</style>
<div>Block Element 1</div><!-- Occupies a separate line --><div>Block Element 2</div><!-- Automatically wraps to the next line --><styletype="text/css">div{width: 100px;/* If not specified, the default width is 100% */height: 100px;/* Height can be specified */color: #333;background: #eee;padding: 10px 20px;/* Padding is effective in all four directions */margin: 10px 20px;/* Margin is effective in all four directions */}</style>
<input/><!-- Arranged in a line --><input/><!-- Arranged in a line --><input/><!-- Arranged in a line --><styletype="text/css">input{width: 100px;/* Width can be specified */height: 100px;/* Height can be specified */padding: 10px 20px;/* Padding is effective in all four directions */margin: 100px 20px;/* Margin is effective in all four directions */}</style>
<!DOCTYPEhtml><html><head><title>Inline Elements vs Block Elements</title><styletype="text/css">div{width: 100px;/* Default width is 100% if not specified */height: 100px;/* Height can be specified */color: #333;background: #eee;padding: 10px 20px;/* Padding is effective in all four directions */margin: 10px 20px;/* Margin is effective in all four directions */}span{width: 1000px;/* Width cannot be specified */height: 1000px;/* Height cannot be specified */color: #333;background: #eee;padding: 100px 20px;/* Padding is effective in the horizontal direction, but only has visual effect in the vertical direction and has no effect on other elements */margin: 100px 20px;/* Margin is effective in the horizontal direction, but has no effect in the vertical direction */}input{width: 100px;/* Width can be specified */height: 100px;/* Height can be specified */padding: 10px 20px;/* Padding is effective in all four directions */margin: 100px 20px;/* Margin is effective in all four directions */}</style></head><body><section><div>Block Element 1</div><!-- Takes up a whole line --><div>Block Element 2</div><!-- Automatically wraps to the next line --></section><section><span>Inline Element 1</span><!-- Arranged in a line --><span>Inline Element 2</span><!-- Arranged in a line --><span>Inline Element 3</span><!-- Arranged in a line --></section>```html
<section><input/><!-- Arranged in one line --><input/><!-- Arranged in one line --><input/><!-- Arranged in one line --></section></body></html>