天天看點

html div重疊上方,html – 将父div上方的子div對齊到右邊,不要重疊

您可以在.parent中使用calc()以及.child中的position:absolute,通過閱讀您的注釋,它不會有第二個父級有問題的内容.

.container {

border: 1px solid green;

position: relative;

min-height: 200px;

}

.parent {

max-width: calc(100% - 220px)

}

.child {

position: absolute;

top: 0;

right: 0;

}

Hello world! I don't want to overlap with the image. Hello world! I don't want to overlap with the image. Hello world! I don't want to overlap with the image.

html div重疊上方,html – 将父div上方的子div對齊到右邊,不要重疊

Hello world! I don't want to overlap with the image. Hello world! I don't want to overlap with the image. Hello world! I don't want to overlap with the image.

Hello world! I don't want to overlap with the image. Hello world! I don't want to overlap with the image. Hello world! I don't want to overlap with the image.