Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Trying to center a video
Message
From
04/07/2017 00:10:58
 
 
To
All
General information
Forum:
CSS
Category:
Layouts
Title:
Trying to center a video
Miscellaneous
Thread ID:
01652399
Message ID:
01652399
Views:
64
I have this code which is used to center a video:
<style>
.DivParse
{
   position: relative;
   padding-bottom: 56.25%;
}

.DivParse iframe
{
   position: absolute;
   width: 100%;
   height: 100%;
}
</style>

<center>
<div style="max-width: 691px; width: 100%;">
<div class="DivParse">
<iframe src="https://www.youtube.com/embed/2QKg5SZ_35I" frameborder="0" allowFullScreen></iframe>
</div>
</div>
</center>
When running this code on a browser, the video is centered.

Try to code that code on iPhone Safari and see how the video is pulled to the right.

This is due to the code which embeds all this to make the video auto resize accordingly to various medias. However, center is center and it should be centered. But, there is a conflict here and it doesn't. Basically, I need an adjustment in there so it would be centered if the width is greater than 691 pixels or simply shown as is in iPhone Safari.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Reply
Map
View

Click here to load this message in the networking platform