HTML+CSS Easy to Get Started with Floating Model
-shaped elements are so overbearing that they occupy one line. What if we want two block-shaped elements to be displayed side by side? Don't worry, setting the element to float can achieve this wish.
Any element cannot float by default, but it can be defined as floating using CSS. Elements such as div, p, table, img, etc. can be defined as floating.
Let’s do this Write a floating example, the code is as follows
流动模式下的内联元素
The above code is that the block element div occupies an exclusive line. Now we need to display them on one line, and then add some distance between the two divs. Please see the following code:
流动模式下的内联元素
In this way, the effect we want is completed. First, we need to make a float to the left for the first div, and the same for the second one. Then the two will be linked together and displayed on the same line.
Next we make a left border for the second div and that’s it