Place background image 1em from the right?

后端 未结 4 996
抹茶落季
抹茶落季 2021-02-12 21:58

As far as I can tell, it is not possible to place a CSS background image 1em from the right border of any block, neither is it possible to place a image 1em from the bottom.

4条回答
  •  滥情空心
    2021-02-12 22:57

    Elements with position: absolute; can be positioned by their right edge. So, if you don't mind a minor change to the html, do this:

    Text text text text....
    (...) #the-box { position: relative; } #the-box-bg { position: absolute; right: 1em; z-index: -1; }

    You could of course also use absolute positioning of a second div, with a repeating background. But then you would have to set the size of the (inner) div in CSS.

提交回复
热议问题