Stop absolutely positioned div from overlapping text

前端 未结 8 2003
旧时难觅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.

提交回复
热议问题