CSS: have a div after an absolute positioned div

后端 未结 4 2035
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-08 06:09

I was wondering how to do this, my current mark up is as follows:

4条回答
  •  再見小時候
    2021-02-08 06:49

    If you're using absolute positioning but you don't know the height of what you're positioning, that is a problem that HTML isn't very good at solving. I have seen (and probably written) hacks where JavaScript is used to position an element based on the offsetHeight of another.

    But you might be better off using the CSS float property instead of absolute positioning. float and clear are pretty good for positioning things like you want, without sacrificing automatic page flow.

提交回复
热议问题