Trying to add an image inside a CSS Grid

后端 未结 1 1750
谎友^
谎友^ 2021-01-26 11:17

How would I be able to put an image inside a CSS Grid?

This is all I\'m trying to do and can\'t figure it out.

This was my attempt at a CSS Grid:

相关标签:
1条回答
  • 2021-01-26 12:05

    You can try to use some gradient in case you cannot change the background image

    .wrap {
      position: relative;
      width: 600px;
      height: 600px;
      margin-top: 45px;
      border:4px solid red;
      background-color:red;
      overflow: hidden;
      border-radius: 25px;
      background: 
        linear-gradient(red,red) calc(100%/3 - 1px)   0% /4px 100%,
        linear-gradient(red,red) calc(2*100%/3 + 1px) 0% /4px 100%,
        linear-gradient(red,red) 0% calc(100%/3 - 1px)   /100% 4px,
        linear-gradient(red,red) 0% calc(2*100%/3 + 1px) /100% 4px,
        url("https://i.imgur.com/1TbGgqz.png") no-repeat 0 -600px;
      background-repeat:no-repeat;
    }
    <div class="wrap">
      
    </div>

    0 讨论(0)
提交回复
热议问题