Stop absolutely positioned div from overlapping text

前端 未结 8 1731
旧时难觅i
旧时难觅i 2020-12-24 06:03

Here is a simplification of my layout:

相关标签:
8条回答
  • 2020-12-24 06:53

    Short answer: There's no way to do it using CSS only.

    Long(er) answer: Why? Because when you do position: absolute;, that takes your element out of the document's regular flow, so there's no way for the text to have any positional-relationship with it, unfortunately.

    One of the possible alternatives is to float: right; your div, but if that doesn't achieve what you want, you'll have to use JavaScript/jQuery, or just come up with a better layout.

    0 讨论(0)
  • 2020-12-24 06:53

    Could you add z-index style to the two sections so that the one you want appears on top?

    0 讨论(0)
提交回复
热议问题