WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [closed] Automatically Resize Video (8 posts)

  1. fatalx
    Member
    Posted 5 years ago #

    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

  2. fatalx
    Member
    Posted 5 years ago #

    anyone?..............

  3. esmi
    Forum Moderator
    Posted 5 years ago #

    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.

  4. fatalx
    Member
    Posted 5 years ago #

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

  5. esmi
    Forum Moderator
    Posted 5 years ago #

    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.

  6. fatalx
    Member
    Posted 5 years ago #

    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.

  7. wp_ntnguy
    Member
    Posted 4 years ago #

    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.

  8. jaykin
    Member
    Posted 4 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic