Multiple background-images and a background-color

前端 未结 2 1542
栀梦
栀梦 2020-12-03 15:16

Suppose I want to render an arrow in CSS, which should have a head, a tail and flexible width so it can contain text. I can of course create multiple divs to get what I want

2条回答
  •  遥遥无期
    2020-12-03 15:39

    I find using multiple background images to be problematic for things like this. Have you considered using the :before and :after pseudo elements? I wrote up a quick example:

    
    
    
    This text is on a transparent background

    Just replace the background color in the :before and :after declarations to the arrow images you want.

提交回复
热议问题