I used flexbox to vertically center my div. it works fine on the desktop, however does not work on mobile. It is centered in portrait orientation, however once titled to landscape, the text is no longer centered and is appeared cut off, where the user has to scroll to read the full text (see img below)
Please give me some advice on how to solve this. Thanks. I've tried putting overflow to hidden and that didn't work as well.
.vertical-align {
height:auto;
min-height: 100vh;
/* Make it a flex container */
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
/* Align the bootstrap's container vertically */
-webkit-box-align : center;
-webkit-align-items : center;
-moz-box-align : center;
-ms-flex-align : center;
align-items : center;
-webkit-box-pack : center;
-moz-box-pack : center;
-ms-flex-pack : center;
-webkit-justify-content : center;
justify-content : center;
flex-direction: row;
width:100%;
text-align: center;
font-size: 0;
}
/*CONTENT*/
.container-fluid{
margin:0 auto;
padding:0;
/* padding:50px;
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
*/}
.left-col{
padding-left:50px;
}
.right-col{
padding-right:50px;
}
#story_text{
font-size: 18px;
}
/*story*/
#story_text{
text-align:left;
height:100%;
padding-left:50px;
padding-right:50px;
}
#pictures{
text-align: right;
}
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="viewport" content="width=device-width, user-scalable=no" />
<body>
<div class="container-fluid">
<div class="row vertical-align">
<div class="col-lg-4 col-md-3 col-sm-2 col-xs-12, left-col"></div>
<div class="col-lg-4 col-md-6 col-sm-8 col-xs-12" class="content">
<p id="story_text">
The Daily Roundup is the anchoring café at The Working Capitol serving the needs of the TWC community, the immediate vicinity and crepe aficionados across the island. Borne out of our desire to create something truly distinct in the café scene in Singapore. Instead of serving typical brunch items, we have consulted with one of the foremost prestigious French chefs in Singapore to perfect our crepe offering.
<br><br>
The result is a tightly curated list of classic crepes and spritzers serving a largely unmet need in the market: lighter, healthier options for the increasingly conscious palette.
</p>
</div>
<div class="col-lg-4 col-md-3 col-sm-2 col-xs-12, right-col"></div>
</div>
</div>
</body>
--EDIT
additional jQuery added, to detect change of height of flexbox
jQuery(document).ready(function(){
var jQuery(window) = jQuery(window),
jQuery(sections) = jQuery('vertical-align'),
windowHeight;
function adjustHeight() {
// get height of browser window on page load and resize events
windowHeight = jQuery(window.height());
// apply windowHeight to each <section>
jQuery(sections.height(windowHeight));
}
jQuery(window.resize(function() {
adjustHeight();
}));
jQuery(window.load(function() {
adjustHeight();
}));
});