I just learned some html content yesterday, so I couldn't wait to make a search bar on JD.com, but when I was doing the shopping cart checkout, there was a number displayed on it that I didn't know how to add it. If I wanted the numbers to move with the shopping cart, I had to position them together. If I positioned, I would definitely need position. First, set the position of the div to absolute, which has a layered feeling. Because the parent mark of the position of the number at this time is body, so when setting the top and left, you can also set the position to the desired position with the shopping cart. However, if the margin of the shopping cart is changed, the position of the shopping cart is not able to move together, so the position of the shopping cart is set to relative, so the parent mark of the position of the number becomes a shopping cart. No matter how the margin of the shopping cart is adjusted, the number will move with it...
Copy the code