need help with ad scaling
hell, im kinda new to this... I have a div container which is a flex. inside that I have an iframe that is 700x100 dimension. Actually, it is a bit more nested, but I'm trying to keep it simple
the ad must be 700x100. but the container must scale with the width media. as the container shrinks, the ad inside overflows. Instead I need the ad to scale down to fit within the parent container div.
Thanks in advance.
1 Reply
Why do you want the content to change size based on the parent? That's backwards. The container should be sizing itself to accommodate the content :p
If the advert is a fixed size then it should be easy to set it inside a container as you know the dimensions of it and can easily fit it in. Or are you more worried about if the viewport shrinks to be less than 100px wide?
If that's the case, you have a few options. If the ad is an image then you can set
max-width: 100%;
so it doesn't get any wider than the containing element. But being an iFrame I'm guessing that it's not simply an image. In that case you probably want to add some overflow: scroll;
to the container element. That way the advert won't overflow the containing element and instead add scroll bars.