• Resolved mckaymental

    (@mckaymental)


    Hi! I’m trying to add this bit of code into visual editor but it doesn’t show the image:

    bg-img{
    background-image:url(‘imagefile.jpg’);
    width:100%;
    }
    <bg-img></bg-img>

    Do you know why it doesn’t work?
    I could use the wordpress background image feature but I can’t get it to be responsive. I really need the background image to keep a width of 100% while resizing.

    Thanks for your help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • <bg-img></bg-img> is not a valid HTML tag.

    You should use:

    <div class="my-class"></div>

    and your CSS should look like so:

    .my-class {
      background-image:url('imagefile.jpg');
      width:100%;
      height: 200px;
    }

    Also, make sure your file path is correct. Best of luck.

    Thread Starter mckaymental

    (@mckaymental)

    Works perfectly! Thanks a lot!

    No worries. Best of luck.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Can't add image-background css in a row.’ is closed to new replies.