Currently I have 1860px wide image as featured image which shows on top of a post page, and 800px as post content width, and when I

Set $content_width = 800

The featured image shows as 800px wide only

Set $content_width = 1860

Featured image shows well, but embedded youtube video shows as 1860 x 1077, I tried to set max-width:100% on iframe, it fixed the width, but height still 1077, a height:auto has no effect.

Any suggestion?


You can set iframe tag with width:100%
Let say you have the following structure

<div class='video'>
     iframe tag here    
.video iframe {
    width: 100%; // this will automatically adjust the height
  • Same to "max-width:100%", the iframe generated by WordPress have attributes of width="1860" and height="1077", height doesn't change – Edward Aug 30 '16 at 13:58
  • Could you please share site url of that ? – Faisal Ramzan Aug 30 '16 at 15:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.