WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Automatically Resize Video

[Resolved] Automatically Resize Video

  • Hey,

    I want videos from posts that have them, to be automatically resized when they are in the sidebar or the homepage, and then full size when they are looked at in the post.

    I have seen this done on other sites. How can this be done?

    Thanks

Viewing 7 replies - 1 through 7 (of 7 total)
  • anyone?…………..

    esmi

    @esmi

    Forum Moderator

    You could try using CSS percentage width and height and specify them differently depending whether a video is in a post or in the sidebar. However, for this to work, you’d need to avoid adding any width or height attributes to the embed markup. Plus, the resolution might be poor when the video is resized via the browser.

    how would I have the CSS apply to only the video and not the entire excerpt?

    esmi

    @esmi

    Forum Moderator

    I assume you’re using either the embed or object element to actually embed the video. Yes? So you could use something like:

    .post embed {
    width:75%;
    height:75%;
    }

    I have to admit that I’ve not tried this myself but it might be worth a shot.

    hey,

    that code didn’t work but you lead me along the right path. This code did the trick

    .post object{
    width: 75%;
    height: 75%;
    }

    It does exactly what I need, and its amazingly simple, I didn’t know that CSS could effect object attributes.

    Thanks esmi you helped me out alot.

    I tried .post embed and that worked in Internet Explorer but does not work in Safari and Google Chrome.

    You need to have both .post embed and .post object with the exact same attributes in order for it to work on all browsers as far as I have tested.

    Its worked for me, but with some css hacks

    try this

    .post embed {width:620px;height:349px;border: 10px solid #5eb7cb;} /* Applies to all browsers */
    *.post embed {width:600px;height:338px;border: 10px solid #5eb7cb;} /* Applies to all IE browsers */
    _.post embed {width:600px;height:338px;border: 10px solid #5eb7cb;} /* Applies to all IE browsers 6 and below */
    .post embed {width /*\**/:620px\9;height:349px;border: 10px solid #5eb7cb;} /* Applies to IE 8 */
    
    <strong>or you can add</strong> .post embed, object {...}
    Try it hop it will work

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Automatically Resize Video’ is closed to new replies.
Skip to toolbar