JSFiddle - React, Tailwind, and code Playground

by norsewulf

HTML

<div class="fma">
        <div class="static">
	        <div class="headline">
	        	<div class="wrapper">
	            	<h3>Fusce dapibus, tellus ac cursus commodo, tortor mauris.</h3>
	            </div>
	        </div>
	        <div class="image">
	        	<img alt="Alt Text" src="http://dummyimage.com/800x400/6b6b6b/ffffff.jpg">
		    </div>
        </div><!-- /.static -->

    </div>

CSS

html {
     overflow: -moz-scrollbars-vertical;
     overflow: scroll;
}
.fma .static {
    position: relative;
}

@media screen and (min-width: 480px){
    .fma .static .headline {
    text-align: center;
    background: none repeat scroll 0 0 rgba(255, 255, 255, 0.8);
    float: left;
    left: 0;
    margin-left: 0;
    margin-right: 0;
    position: absolute;
    top: 0;
    width: 100%;
  }
}
.fma .static .headline h3 {
    font-size: 12px;
    line-height: 1.5em;
    margin-bottom: 0;
    margin-top: 0;
    padding-bottom: 1.5em;
    padding-top: 1.5em;
}
.fma .static .image img {
    height: auto;
    margin-top: 0;
    max-height: 100%;
    max-width: 100%;
    padding-bottom: 0;
    padding-top: 0;
    width: auto;
}

JavaScript

/* Vertical Align Center */
$.fn.vAlign = function() {
    return this.each(function(i){
        var ah = $(this).height();
        var ph = $(this).parent().height();       
        var mh = Math.ceil((ph-ah) / 2); //var mh = (ph - ah) / 2;
        $(this).css('margin-top', mh);
    });
};

/* Min Screen 480 */
	function minScreen480(){
	    if ($('body').innerWidth() >= 480) {
	    	// Vertical Align Static FMA Headline
	        $('.fma .static .headline').vAlign();
	    }else{
	    	// Remove Vertical Align from Static FMA Headline
	        $('.fma .static .headline').css('margin-top','');
	    }
	}

/* WINDOW RESIZE */
	$(window).resize(function(){
		minScreen480()
	}).trigger('resize');