javascript - How to align content on a banner if there's a HTML5 video involved -


i may need re-title post. have html5 video i'm having hard time styling way want to.

html

<header>         <div class="video-holder full-img">             <video autoplay loop muted>                 <source src="<?php bloginfo('template_url'); ?>/img/syau.webm" type="video/webm">                 <source src="<?php bloginfo('template_url'); ?>/img/syau.mp4" type="video/mp4">             </video>         </div>         <div class="container" style="height:100%">             <div class="row" style="height:100%">                  <div class="banner-text col-sm-12 col-md-6 col-md-offset-2">                     <h1>step<br>your<br><span id="type-selector" class="typed-element"></span><br>up</h1>                 </div>                 <div class="btn-container col-md-2">                     <div class="btn-cta">                         <a class="btn btn-primary btn-lg" href="/roster/">check out</a>                     </div>                 </div>              </div>         </div>     </header> 

this how i'm doing html5 video. have javascript height of device banner matches it.

javascript

function windowresizefunctions(e) {          var windowh = $(window).height(),             headerh = $('#my-navbar').height();          $('header').css('height', windowh);      }      $(window).resize(function(){         window.requestanimationframe(windowresizefunctions);     });        settimeout(function() { windowresizefunctions();      }); 

this css

header {     position: relative;     overflow: hidden;     width:100%;     height:100vh; } .banner-text {     position: relative;     z-index: 200;     text-align: left;     display: table;     float: left;     height: 100%; } .banner-text h1 {     display: table-cell;     vertical-align: middle; } .btn-container {     z-index: 201;     height: 100%;     display: table; } .btn-cta {     display: table-cell;     vertical-align: bottom;     padding-bottom: 90px; }  .video-holder {     position:absolute;     height:100%;     width:200%;     left:-50%; } video {     position:absolute;     top: -99999px;     bottom: -99999px;     left: -99999px;     right: -99999px;     margin: auto;     min-height:100%;     min-width:50%; } 

now, real live example. on laptop looks how want it, on else it's hard work with. i'm trying achieve banner text on left, , button on bottom right of container it's leveled baseline of last word.

i thought flexbox. tried giving .row display:flex , .banner-text align-items:center; wouldn't work. tried variety of html changes move things around , couldn't it, i'd post attempts question become massive.

i want this on laptop/desktop. on tablet , mobile want stack, text on top , button below. coded terribly , i'm not sure how it.

put <a> button inside <h1> tag -- last element.

increase width of <h1> tag changing parent class col-md-6 col-md-8.

set following css button:

float:right; position:relative; top:40px; 

it's little hacky , there's def better solutions out there require restructuring entire dom. easiest fix.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -