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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![ahmed yaseen](https://secure.gravatar.com/avatar/f4b2d1d254d29fba2cf7005370bc999c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
ahmed yaseen
92 Pointscentering a youtube video in css i wanna make a video page and center the video in middle i tried but i doesnt move
i wanna make a video page and center the video in middle i tried but i doesnt move
5 Answers
![ahmed yaseen](https://secure.gravatar.com/avatar/f4b2d1d254d29fba2cf7005370bc999c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
ahmed yaseen
92 Pointsvtest
{ margin: 0px auto; } and i tried left:50% top:50% transform:translate i applied alot of videos
evan rost
Courses Plus Student 13,971 Pointswhat element are you targeting? is this for a code challenge?
![ahmed yaseen](https://secure.gravatar.com/avatar/f4b2d1d254d29fba2cf7005370bc999c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
ahmed yaseen
92 Pointsno i,m making a website and i completed it but i wanna make a video page and im targeting the i frime and i give it an id then i put it in a div and no thing happent
evan rost
Courses Plus Student 13,971 Pointsits hard to tell without seeing more of your code. is your project on github? here is a link to a good article on css centering. https://css-tricks.com/centering-css-complete-guide/
![Parth Gada](https://uploads.teamtreehouse.com/production/profile-photos/6536302/micro_21731145_1501732133252740_3413169937816022715_n.jpg)
Parth Gada
8,484 PointsCreate a div class in your HTML file and use align-content: center; property in CSS to center it
![ahmed yaseen](https://secure.gravatar.com/avatar/f4b2d1d254d29fba2cf7005370bc999c?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
ahmed yaseen
92 Pointsidid but it appears left top it doesnt move
![ahmed yaseen](https://secure.gravatar.com/avatar/f4b2d1d254d29fba2cf7005370bc999c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
ahmed yaseen
92 Pointsthanks alot bro i.ll see
![Rachel Campbell](https://uploads.teamtreehouse.com/production/profile-photos/9095042/micro_pinkswipe.jpg)
Rachel Campbell
9,103 PointsIs it a YouTube iframe embed code? If so, wrap the entire <iframe>....</iframe> in another set of <div> </div> tags and set <div style="text-align:center">. Maybe not the most elegant solution, but it works for the YouTube embeds. So, for example (I just picked a random video):
<div style="text-align: center;">
<iframe width="560" height="315" src="https://www.youtube.com/embed/zrdQrHu158E" frameborder="0" allowfullscreen></iframe>
</div>
evan rost
Courses Plus Student 13,971 Pointsyou may have to make the parent elements width 100%, then try centering the child element
evan rost
Courses Plus Student 13,971 Pointsevan rost
Courses Plus Student 13,971 Pointshi ahmed, can you post your code?