Solved

How to center div height of video in html page

Posted on 2014-09-30
3
204 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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
This article discusses how to create an extensible mechanism for linked drop downs.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

805 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