Text wraps around floating div but borders and
s do not

后端 未结 5 2070
南笙
南笙 2021-01-04 05:09

I have a div that is float: right and it is inside a parent div. There are p elements inside that same parent div also, and the text wraps around t

5条回答
  •  醉话见心
    2021-01-04 05:51

    I know this problem was posted some time ago, but I had the same problem today and found another solution:

    http://jsfiddle.net/MvX62/

    I use border-bottom instead of the


    tag and had to add an overflow: hidden;. Look at the fiddle, i think this is more useful then the accepted solution, because you can also add a margin to the horizontal line and there is the same gap, as the text has.

    Also you don't need to define z values and don't need any hacks or workarounds.

提交回复
热议问题