Custom css with html embed

I want the pictures i get from the a link in my CMS to cover the div block. I have the html embed at 100%x100% inside another div block. Can someone tell me where i went wrong? Look at the pictures below. Thank you so much!



1 Like

Good question, @Stig_Ark.

Could you provide your sites read-only link: Share a read-only link | Webflow University

I’d be happy to take a look to see if I can help :blush:

@micahryanhtml

here is the link: https://preview.webflow.com/preview/artistpartner?preview=6b7b6f740455a55683c2996a00ae7ee9

And the page thats in question is the page “aktuelt”

1 Like

I would suggest uploading those images to your collection, and using the the collections option to use the image as a background image:
webflow-background-image-cms

Hopefully this helps :blush:

@micahryanhtml The thing is, i am getting these URL´s from zapier RSS feed from a facebook page. And zapier do not import pictures, thats why i import the links. :S

@Stig_Ark Gotcha.

Okay, you would need to change the structure to the following so that the URL used is placed in the div’s background. Please note that you will need to enter in a specific height, and I would suggest adding this to the head via a class if you need to add media-queries:
<div style="height:100px;background-image: url(Bilde);background-size: cover;background-position: center;background-repeat: no-repeat;"></div>

by BG the answer above.

If you want by <img> (better for seo) this code works fine. Anyway remember to upload better Q images + :::::::: Also its better to also add alts

<div class="image123">
  <img style="width: 100%; height: auto;" src="{{img}}" alt={{alt}} />
 </div> 

“where i went wrong” Embed is already 100% (a div) - but you should style the content inside.

If you want “img” behave like “cover” - this is more tricky - try this ideas:
https://stackoverflow.com/questions/14142378/css-filling-a-div-with-an-image-while-staying-in-proportion

@Siton_Systems and @micahryanhtml Thank you so much for the help guys! :slight_smile: