Solved

How to center div height of video in html page

Posted on 2014-09-30
3
208 Views
Last Modified: 2014-10-08
I was able to center a div which contains a <video> but I am also trying to center the video tag as far as height is concerned.  So, how do you center the height in the middle of your page?
0
Comment
Question by:VBBRett
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40352436
Well if you are using <video> then you are supporting  modern HTML5 browsers that should also be supporting the CSS calc() function and the viewport relative units of neasure so you should be able apply what is on this page that contains practical examples using calc()

Cd&
0
 

Author Comment

by:VBBRett
ID: 40352534
Hi COBOLdinosaur, I attempted to use the example but for some reason was unable to get to work.  Here is my markup as of yet:

<!DOCTYPE html>
<html>
<head>
    
    <style type="text/css">
        html {
    position: relative;
    min-width: 1024px;
    min-height: 768px;
    height: 100%;
}

        #videostyle {
            margin-left:auto; 
            margin-right:auto;
            margin-top:auto;
            margin-bottom:auto;
            height:480px;
            width:854px;            
        }
    </style>
    <title>Test Page</title>
</head>
<body>
    <div id="videostyle">
        <video id="vidintro" autoplay="autoplay" width="854" height="480" contenteditable="false">
            <source src="web.mp4" type="video/mp4" />            
            Your browser does not support the video tag.
        </video>
    </div>
    <script type="text/javascript">
        var vid = document.getElementById("vidintro");
        vid.controls = true;    
    </script>
    <script type="text/javascript">
        var vid = document.getElementById("vidintro");
        vid.onended = function () {            
            location.href = "http://www.testsite.com";
        }
    </script>
</body>
</html>

Open in new window

0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 500 total points
ID: 40352640
I don't see where you are applying anything that would center vertically, and do analysis of the page we really need a link so we can use diagnostic tools.

Cd&
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Read text on Table 7 49
output in HTML format powershell 6 50
CSS overflow problem 21 41
Slow Down an Animation 3 29
When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
Find out what you should include to make the best professional email signature for your organization.
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question