Please tell me, how can I position something inside a div? For example, I have a ul inside a div, but I want to control the ul to be lower in the middle of the div. How do I set it up? Seek answers online
Use margin padding
and absolute positioning both can
margin and padding Don’t you need to specify a specific value? Is there a similar method like setting center?
Generally, you just write a fixed value, or you can also use js to set it dynamically.
I generally use the following two attributes,
margin, outer border:
controls the size of the margin around the border. It contains 4 attributes: margin-top controls the width of the top margin, margin-right controls the width of the right margin, margin-bottom controls the width of the bottom margin, and margin-left controls the width of the left margin.
padding, inner border:
determines the amount of space padding surrounding the block element, which contains 4 attributes: "padding-top controls the width of the top blank, padding-right controls the width of the right blank, and padding-bottom controls The width of the lower margin and padding-left control the width of the left margin.
In addition, pay attention to: the absolute, relative and static properties of the position; setting this attribute will affect margin and padding. >
and absolute positioning