text on top of image css

前端 未结 2 474
借酒劲吻你
借酒劲吻你 2020-12-12 05:03

I am trying to place a div with text on top of an image but for some reason it doesn\'t work. My code is:

2条回答
  •  攒了一身酷
    2020-12-12 05:36

    How about setting the picture as background via the background-image: attribute. You then could make your div clickable with

    In detail your css would look like this:

    .image {
      width:310px;
      height:310px;
      background-image:url('pathtoimage');
    }
    

提交回复
热议问题