Differences between using float and display: block to convert inline elements into block elements: floatblock
Differences between using float and display: block to convert inline elements into block elements:
Suggestion: writing code as much as possible can effectively improve learning efficiency and depth.
Inline elements can be converted into block-level elements. For example, you can use the float attribute to float inline elements or add a display: block to inline elements. Both of them can convert inline elements into block-level elements, but they are different. The code example is as follows:
<! DOCTYPE html>
The above Code uses float to convert Element a to a block-level element. It can be seen that the width is determined based on the content. Let's look at a code example:
<! DOCTYPE html>
The code above adds the display: block for element a to convert it into an accounting element, but the width is not determined based on the content, but the default state is width: 100%.
There may be more differences between the two. You are welcome to leave a message to add.
The original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 4615.
For more information, see: http://www.softwhy.com/divcss/