Responsive Height/Width Video Header

前端 未结 1 1844
自闭症患者
自闭症患者 2021-02-04 20:55

I\'m working on making a responsive html5 video header for a website, I would like it to respond vertically as well as horizontally, using CSS only for responsiveness.

<

1条回答
  •  说谎
    说谎 (楼主)
    2021-02-04 21:34

    HTML elements are left and top aligned. What you could do is to expand the container to a large size and use margin: auto

    Example CSS:

    video {
        position:absolute;
        top: -99999px;
        bottom: -99999px;
        left: -99999px;
        right: -99999px;
        margin: auto;
        height: auto;
        min-height:100%;
        min-width:50%;
    }
    

    Demo: http://jsfiddle.net/mLnsbyk1/

    0 讨论(0)
提交回复
热议问题