Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

Can't make my video Fit in the Div borders

I can't seem to get my video to fit within the boundaries i have set for my div.

<div class="videoTrailer">
    <video class="trailer" controls>
        <source src="video/trailer1.mp4" type="video/mp4">
    </video>    
</div>
/* Setting up the size I want the div to be */
.videoTrailer {
    border-style: solid;
    border-color: red;
    border-width: 5px;
    width: 78%;
    height: 600px;  
    float: left;
}

I did some research on positions (absolute/fixed) and it wasn't producing what I wanted and i got all confused. Can anyone help me?

Mod Note - Added backticks and languages for code formatting and syntax highlighting.

How to Post Code on the Treehouse Forums

5 Answers

Does it work if you add the following CSS?

video {
  max-width: 100%;
}

Nope, it just goes outside the border-lines. How do i up load an image to show you?

If you're using workspaces, you can post a snapshot of you code using the camera icon in the top right of the screen. This is probably the best solution since then I can see both the outcome, and your code.

It works, i fixed it. Thanks for the help. :)

Forgot the cascading rule :/

Sorry for the delay, glad you got it working! :)

ok, i'll do that. Sorry for the delay.

Ok i did a screenshot in the workspace. What do I need to do to allow you to see it?

Please post the link generated by the snapshot. This is different than a link to your workspace.