To make iFrames responsive and mobile-friendly, enclose the iFrame in the div container. This will allow the iFrame to automatically resize based on the screen’s width. To do this, add the following to the HTML code: You can also add CSS to the iFrame code: .container { padding-top: 56.25%; The percentage value is useful when embedding YouTube videos to ensure full visibility.