L shaped text box on a website - html

I am trying to create the following text box design on a website. I could use images for the white boxes, but the issue is that I am not sure how to create an L shaped text area where the words wrap and fit nicely into those white boxes.
Does anyone know how to achieve this, or point me to the right direction to investigate?

Try CSS Exclusions.
CSS Exclusions define arbitrary areas around which inline content
can flow. CSS Exclusions can be defined on any CSS
block-level elements. CSS Exclusions extend the notion of content
wrapping previously limited to floats.
They are specifically related to word-wrap.

This is what you need
<style type="text/css">
#grid {
width: 30em;
height: 30em;
display: grid;
grid-columns: 25% 25% 25% 25%;
grid-rows: 25% 25% 25% 25%;
#top-right {
grid-column: 3;
grid-row: 2;
}
#bottom-left {
grid-column: 2;
grid-row: 3;
}
.lshapify {
wrap-flow: both;
}
#content {
grid-row: 1;
grid-row-span: 4;
grid-column: 1;
grid-column-span: 4;
}
</style>

I can't give you an exact solution to your problem but you could investigate and leverage from CSS shape-outside techniques to solve this problem. Unfortunately there is limited support for this at the moment so it depends on the browsers you wish to target. A nice tool exists to check at http://caniuse.com/
You may encounter some issues with overlaying the content as you might not know the amount of text that needs to be catered for. Perhaps some JavaScript could solve that problem.
The below example shows how you can add a block using a CSS inset but I think you can use a polygon and position another block over it.
* {
box-sizing: border-box;
}
body {
margin: 0 auto;
max-width: 750px;
font-size: 10px;
}
div {
shape-outside: inset(50px 50px 50px 0px);
width: 200px;
height: 200px;
float: left;
}
<p>Sample used from CodePen at http://codepen.io/team/css-tricks/pen/b2da5018d8f20ac3a2ccc26edb724db6</p>
<div></div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Officiis impedit libero esse odio excepturi fuga est ut itaque a quod suscipit, rerum asperiores. Consequuntur voluptates illo rerum recusandae pariatur asperiores, aspernatur, saepe ipsum error dolorem, quod inventore possimus modi deleniti tenetur et officiis.</p>
<p>Nemo ab in totam ratione sequi error, ea dolorum repudiandae omnis, eaque facere impedit fugiat. Dolorum distinctio autem sequi enim quidem esse accusamus repudiandae voluptatum nobis, velit, molestiae. Eaque maiores, harum. Saepe esse repellendus sint.</p>
<p>Labore provident optio quis commodi quod quaerat quo similique perspiciatis libero facere. Suscipit odit quas nemo, enim laudantium, provident repellendus natus nostrum facilis expedita adipisci qui, harum minus quidem officia cupiditate repellat ut praesentium. Possimus corporis, error atque ex adipisci, illum suscipit pariatur saepe impedit aliquam amet eos reiciendis quidem hic, nisi. Sint nobis modi, nesciunt quasi placeat quia.</p>
<p>Veniam inventore corrupti quisquam illum debitis vitae accusamus nobis alias cum iste error magnam, cupiditate earum! Incidunt at consequuntur, rem ipsa odio ipsum deleniti repudiandae blanditiis harum ut in, fugit officia rerum ad, corporis dolore!</p>
<p>Commodi repellendus esse quibusdam enim qui totam ipsum, consequuntur officia vel dolores, quod corrupti eveniet maiores minus explicabo, sapiente ratione doloribus laboriosam impedit nesciunt a obcaecati quam veritatis! Placeat, velit possimus delectus, atque voluptate iste alias illo, dolor odit ipsa facere quibusdam? Non omnis aliq.</p>

Related

How can i add image in scroll bar with html and css?

First of all, excuse me for my level of English, I'm French and you know our reputation :)
So here is my problem:
I'm trying to customize my scrollbar but with an image I've tried many things to do it but I don't really know java and the only guide I've seen was only in java...
I don't know how to do it so if you have any advice don't hesitate to send it.
thanks
For this issue, you'd want to use the webkit scrollbar css api. Please keep note that this api isn't available for both Microsoft Edge and Firefox. For more information, please visit this url. Below is an example for your case:
.main {
width: 250px;
height: 300px;
padding: 2px;
overflow-y: scroll;
border: 2.5px solid black;
}
p {
margin: 0;
}
.main::-webkit-scrollbar {
/* this sets the width of the bar, in the div.main (::-webkit-scrollbar is fro the body/html)*/
width: 20px; /* change for scrollbar width */
}
.main::-webkit-scrollbar-track {
/* scrollbar background */
background-color: lightgray;
}
.main::-webkit-scrollbar-thumb {
background-color: red; /* will leave after image loads */
background-image: url("https://picsum.photos/100/400");
background-size: cover;
}
.main::-webkit-scrollbar-thumb:hover {
/* feel free to set this for when the mouse is over the bar */
}
<div class="main">
<p>
Lorem ipsum dolor sit amet consectetur adipisicing elit. Non asperiores
quos, suscipit officiis, impedit sapiente unde modi quia voluptatibus, id
cupiditate nesciunt. Officia, in animi distinctio commodi perspiciatis ad
eligendi! Earum ab porro perferendis inventore, asperiores quaerat quis
voluptate ducimus odio officia numquam nobis ipsum consectetur deleniti
natus aspernatur, a temporibus illo culpa quia, similique iste quas sunt.
Architecto, rerum. Qui, nostrum. Molestias, placeat maiores dignissimos id
laboriosam eos error possimus voluptas ipsum aut rerum culpa nesciunt
quaerat ipsam sapiente veniam exercitationem dolorum esse illo explicabo
similique? Labore, ab aperiam. Blanditiis animi qui velit nobis fugit! Eius
laborum necessitatibus aperiam sequi explicabo! Alias, neque. Ad veniam
dolor, doloribus assumenda laboriosam vel necessitatibus minima dolorum fuga
ipsa beatae quos, distinctio debitis? Voluptate, neque. Fugiat accusamus,
excepturi, quam aliquid beatae consectetur laboriosam commodi nesciunt et
dolor delectus illo perferendis sapiente ab voluptatem dicta quod! Laborum
possimus sapiente repellat itaque ex facere recusandae?
</p>
</div>

Footer is pushed up when keyboard is open HTML/CSS?

So all I'm trying to do here is add a simple footer to my site which works perfectly when open on desktop but when on tablet or mobile whenever the keyboard is open such as they login the footer moves up the page to just above the keyboard. Is there a method of fixing this, any ideas?
CSS
#footer {
width: 100%;
background-color: #4c66a4;
color: #fff;
position: absolute;
left: 0px;
bottom: 0px;
text-align: center;
}
<div id="footer">
<p>© 2018 SulmaxCP. All Rights Reserved.</p>
</div>
Try using a wrapper inside the body tag.
html,body{
height:100%;
}
.wrapper {
min-height: 100%;
position: relative;
padding-bottom:90px; /* footer's height */
}
#footer {
width: 100%;
background-color: #4c66a4;
color: #fff;
position: absolute;
left: 0px;
bottom: 0px;
text-align: center;
}
<div class="wrapper">
<main>
<div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Perspiciatis necessitatibus earum tenetur itaque ducimus atque nam vitae ab non quasi natus quam, cum hic quod possimus quibusdam inventore minima temporibus.</div>
<div>Optio inventore delectus quas rerum mollitia eum, repellendus voluptatum! Quos, quas nobis delectus, ipsa tempore reiciendis dolore numquam sequi tempora, nostrum in mollitia laboriosam odio labore voluptatem sint. Similique, aliquam.</div>
<div>Sapiente quisquam vitae alias in nesciunt numquam id, distinctio! Doloribus error mollitia, optio debitis ratione quaerat maiores odio nostrum autem commodi tempora magnam, quos necessitatibus nobis aperiam consequuntur perspiciatis deserunt.</div>
<div>Hic facere nam aliquam tenetur officiis, ratione, sunt aliquid perspiciatis distinctio laborum perferendis nisi ullam omnis incidunt, quasi illo corrupti, dolores eius vero ipsum tempore. Tempora consequatur necessitatibus, saepe assumenda.</div>
<div>Eveniet, odit deleniti neque voluptates soluta architecto, quae aspernatur aut minima rerum itaque nobis distinctio ex culpa! Dolore sit vel mollitia aspernatur distinctio voluptatibus! Iste perspiciatis, aliquid a doloribus et.</div>
<div>Molestias, ducimus! Magni doloribus fugiat praesentium dolore minus perferendis, reprehenderit voluptatibus fuga, rerum quam eveniet, odit ut eaque, repellat provident aperiam repudiandae. Quos porro eveniet, dignissimos non quibusdam provident eligendi!</div>
<div>Ducimus unde ea iste alias fugiat debitis natus illo eligendi! Nisi dolor esse totam optio, tenetur distinctio, sequi inventore eaque iure earum suscipit quam ipsam qui quae molestias id expedita!</div>
<div>Veritatis delectus, in laudantium. Excepturi, deserunt! Ullam voluptatem aliquid doloribus ab, officia veniam maiores magnam maxime. Vero esse non dicta autem, aliquam eos dolore harum sed incidunt architecto placeat eaque!</div>
<div>Hic veniam porro autem quia, commodi provident sunt, at tempore libero, consequuntur, accusamus. Vero illo molestias nam, velit hic iure, a sequi, explicabo ipsum voluptates numquam modi dolorum rem culpa!</div>
<div>Iusto a cum nihil eos atque, impedit, debitis quis dolor consectetur ratione ipsam nisi recusandae temporibus possimus. Non, natus a, consequuntur provident facilis nemo assumenda dolorum vitae, eligendi et harum.</div>
</main>
<div id="footer">
<p>© 2018 SulmaxCP. All Rights Reserved.</p>
</div>
</div>
The thing is that footer relating his position from body tag and when keyboard appears body's height changes and footer get on keyboard.
In this type of situation, unfortunately, CSS seems to not have a fix. So you must use javascript to first calculate the height of the window in pixels and then set the css property. You could do it in one line! But I did it in two here:
// PUSH FOOTER TO BOTTOM
var innerScreenHeight = window.innerHeight;
document.querySelector("#footer").style.top = innerScreenHeight + "px";
This is a cheap hacky fix, but:
CSS:
#media screen and (max-width: 800px) {
.hide-footer {
display: none;
}
}
jQuery
$('input').focus(function() {
$('footer').addClass('hide-footer');
});
$('input').focusout(function() {
$('footer').removeClass('hide-footer');
});
This adds the class .hide-footer to your footer as soon as you focus on an input tag. In addition, the footer is only hidden when the screen width is less than 800px (you should customize, but this should cover mobile devices).
You can hide the footer when you focus on input filed and show again footer on focus out of input filed using jquery.
$( "#inputID" ).focus(function() {
$("#footer").hide();
});
$( "#inputID" ).focusOut(function() {
$("#footer").show();
});
You can't fix it because there's nothing wrong, your footer is doing exactly what you've told it to do.
Your CSS rule for the footer is telling it to always 'attach' to the bottom of the window, even when the keyboard on a mobile device is visible, the top of the keyboard is now the bottom of the window.
If you want, you can either remove the position:absolute value or just change it to position:fixed
Another solution might be to add event listeners for focusin and focusout events of the input-element. The respective listener callbacks can then implement some logic to show or not to show the footer.

How can I make a scrolling div take up less than 100% of its parent?

I feel like this should be a really simple problem, but I can't seem to figure it out.
HTML:
<div class="outer">
<div class="inner">
<!-- lots of text -->
</div>
<div class="inner-bottom">
This text should be inside the blue background
</div>
</div>
CSS:
.outer {
height: 300px;
background: #99EEFF;
}
.inner {
height: 100%;
overflow: scroll;
}
.inner-bottom {
text-align: center
}
Fiddle
The goal is to have both inner divs display inside their parent, which has a background specified to visually organize them.
If I don't specify height: 100%; on .inner, it overflows, no matter which I set on the display property. In fact, some values of display even cause height: 100% to not work.
Anyway, I'd really like .inner's size to be dictated by .outer's size, rather than vice versa. How do I do this?
You can do this with Flexbox just use flex: 1 on .inner
body {
margin: 0px;
}
.outer {
height: 300px;
flex-direction: column;
display: flex;
background: #99EEFF;
}
.inner {
flex: 1;
overflow-y: scroll;
}
.inner-bottom {
text-align: center
}
<div class="outer">
<div class="inner">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Veritatis fugiat nulla asperiores rerum sed dignissimos vitae odit consectetur perferendis! Suscipit qui hic iste est tempora blanditiis odit distinctio odio quas amet. Fuga mollitia maxime labore non odio laborum ea facilis distinctio blanditiis exercitationem atque et, facere illo repellat praesentium inventore iure. Minus error expedita veritatis doloribus esse, at cum molestias odit saepe animi harum similique, dolore distinctio est a quidem beatae! Aliquam, similique autem ipsa vitae eligendi iure consectetur. Quasi, odio expedita consequatur, maxime, libero maiores incidunt quia debitis hic provident cum, deleniti? Illo id pariatur, recusandae tenetur! Beatae cum, fuga! Nulla animi deserunt molestiae eum quia dolorum necessitatibus quod eos saepe sint eaque id est cupiditate impedit, doloribus consequuntur ipsum maiores consequatur alias. Magnam accusantium ab quia laudantium iste eum nobis sequi error, atque suscipit repellendus officiis laboriosam alias eos ullam. At inventore quam ullam officia sequi, aliquam. Aperiam dicta eum illo tempora, quas doloribus ducimus sequi placeat, aut id quaerat iure officiis nostrum accusamus atque odio repudiandae saepe autem distinctio. Qui expedita cum animi totam maxime minima labore vitae reprehenderit eligendi porro odio, voluptatem obcaecati sint enim, velit dolores, dolore fugit incidunt sit. Doloremque suscipit, quia libero. Odit nihil beatae eaque suscipit aperiam hic tempore ipsam non quam doloremque, nesciunt voluptate laboriosam a animi assumenda iste velit sunt cumque minima. Quos perferendis, labore. Consectetur quod sequi commodi nesciunt suscipit, molestiae, quia est cum. Beatae nulla, suscipit ducimus nobis voluptas illum enim dicta distinctio similique aliquam sapiente impedit ea non corrupti omnis est obcaecati labore laboriosam quaerat tempora molestias sunt laudantium doloremque? Perspiciatis dolore, excepturi, voluptate nulla nam culpa nostrum dolor, rerum quas iure dolorem incidunt consequatur dolores dolorum laborum ipsam eaque quasi accusamus voluptatum voluptates quisquam. Perspiciatis maxime, assumenda itaque eligendi dolore iste libero debitis ea sint expedita eius illum blanditiis inventore officiis voluptates minima iusto fuga nulla veritatis quo deserunt ad quisquam. Cumque numquam nihil tenetur itaque obcaecati soluta, libero possimus dolore ipsa eum neque amet sunt ad sapiente quos quae deleniti voluptas illo molestiae. Nihil officiis, commodi fugiat architecto blanditiis! Atque neque numquam nobis voluptates accusantium libero tempore veniam fugit officiis alias soluta rem enim, totam aut eos, nam. Fuga labore fugiat, suscipit consequatur ipsum quia praesentium. Reprehenderit praesentium maxime, ea maiores repellat, facere architecto quasi vitae a hic similique impedit commodi dolor, quas necessitatibus saepe ipsum. Nulla distinctio corporis dolor praesentium eum laudantium, asperiores magni minus tempora, iusto veritatis fuga. Totam ratione incidunt, neque blanditiis iure corporis consectetur ea dignissimos nesciunt tenetur ab placeat, harum eaque laboriosam numquam quas ipsum! Earum aperiam, voluptatibus assumenda quisquam dolorem ut eius non provident numquam nostrum rerum, magnam voluptatum beatae quibusdam quasi ad consequuntur perspiciatis fugiat soluta ipsa excepturi! Earum, accusamus quidem! Quos, eaque inventore perferendis quia officiis tempore sequi repellendus incidunt quo, numquam aut mollitia, atque earum architecto. Harum ipsa debitis necessitatibus quos sapiente ad deleniti quod non nihil libero iure voluptatem, omnis possimus tempore eos recusandae! Provident modi nulla dicta, aut possimus dolores nesciunt officiis sunt! Sunt!
</div>
<div class="inner-bottom">
This text should be inside the blue background
</div>
</div>
Flexbox is the way to go here, but if you want a non-flex answer: If you are assigning 300px to the outer div then you can assign fixed pixel values to the inner divs. how big do you want them to be? You can do:
.inner {
height: calc(100% - (insert height of .inner-bottom));
}
Or you can just use percentages that add up to 100 for the height of both elements. Or you can just use pixels that add up to 300. Your call.
You can set the height of the inner element , that is the best way
.inner {
height: 275px;
overflow-y: auto;
}
Use a padding bottom to the parent element, that is 'outer' class.
.outer {
height: 300px;
background: #99EEFF;
padding-bottom: 30px;
}
The text in the inner-bottom is out of the blue background, because the .inner div takes up all available height in the .outer DIV.
If you set the height of the .inner DIV to less than 100%, there will still be some space for the .inner-bottom to fit in the .outer DIV.
So, changing
height: 100%
to for example
height:65%
in the .inner should work.
PS. You can change the 65% to any value less than 100% and it should still work properly.
I figured out a simpler, more dynamic, and more cross-compatible approach using tables.
HTML:
<div class="table">
<div class="tr greedy">
<div class="td">
<div class="scrollable">
<!-- Lots of text -->
</div>
</div>
</div>
<div class="tr">
<div class="td centered">
Text should be inside the blue box
</div>
</div>
</div>
CSS:
.table {
display: table;
height: 300px;
background: #99EEFF;
}
.tr {
display: table-row;
}
.td {
display: table-cell;
}
.scrollable {
max-width: 100%;
max-height: 100%;
overflow: auto;
}
.greedy {
height: 100%;
}
.centered {
text-align: center;
}

Correct usage of 'overflow: hidden' and 'position: absolute'

I created a container inside another container that has position:absolute and top:100%. This container is used to be some kind of fade-out-container, so it actually has no real content.
Now when this containers height exceeds the browser windows height, a scrollbar appears. And this is exactly what should not happen.
Instead I thought I could apply overflow:hidden on body or the parent container, but either too much gets cut off or the fade-out-container itself becomes invisible.
Please have a look at my fiddle and tell me what I'm missing. Thanks!
HTML
<header>
<h1>Demo</h1>
</header>
<footer>
<p>
The orange container wraps the blue one.<br/>The blue containers' height is meant to be cut off of the browser window meaning it's overflow should get hidden if the browser windows' height is insufficient.
</p>
<p>position: relative;<p>
<div class="append gradient">
<p>position: absolute;<br/>
top: 100%;<br/>
left: 0;<br/>
width: 100%;<br/>
height: 100%;</p>
</div>
</footer>
...
CSS
body {background: 333;}
header, footer, .append {
font-family: consolas, console, courier, arial, helvetica;
margin: 0 auto;
color: #FFF;
padding: 15px 30px;
}
header {
background: #666;
}
footer {
background: #F86;
position: relative;
height: 300px;
/*overflow: hidden;*/
}
.append {
background: #66F;
position: absolute;
top: 100%;
width: 100%;
height: 500px;
left: 0;
}
EDIT: updated fiddle, added inline code, added images
When you give top: 100% with a position: absolute, then you are actually sending it fully to the next page. I guess you are trying to make a modal-window, then you need to set it as:
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
The above code will over everything. The overflow: hidden is not applicable here, but when you are planning to show the modal window, or the overlay, it is best to use overflow: hidden to the <body>, so that the users will not be able to scroll and you can find the modal window.
Explaining the whole concept I said using a snippet here. Click the links to invoke the modal window. Click the opened modal window to hide it back. Scroll and see. Play around with it:
$(function () {
$("body > p").append(' Open Modal');
$("p a").click(function () {
$("body").addClass("modal-open");
return false;
});
$(".mask").click(function () {
$("body").removeClass("modal-open");
});
});
.mask {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
display: none;
background: rgba(0,0,0,0.5);
z-index: 999;
color: #fff;
font-size: 1.5em;
text-align: center;
}
.mask p:first-child {
padding-top: 5em;
}
.modal-open {
overflow: hidden;
}
.modal-open .mask {
display: block;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<div class="mask">
<p>Click the links to invoke the modal window.</p>
<p>Click the opened modal window to hide it back.</p>
<p>Scroll and see. Play around with it</p>
</div>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Assumenda vitae temporibus corporis, quisquam, doloremque excepturi itaque laborum ratione sequi aliquid atque rerum rem minima, aperiam laboriosam blanditiis alias ex quas?</p>
<p>Quam dolor, perspiciatis! Perspiciatis voluptatibus magnam ad hic sint, officia voluptates aut labore, excepturi quasi sed sit modi amet temporibus exercitationem laudantium veniam cumque omnis quo! Esse, quas! Harum, iure!</p>
<p>Illo optio alias amet ex consequuntur est autem itaque reprehenderit odit, laboriosam saepe ipsa harum eligendi sit cumque modi cum perspiciatis! Dolorum, alias nostrum asperiores velit atque perferendis voluptatibus. Maiores!</p>
<p>Cumque perspiciatis laudantium sequi itaque eos facilis illum repellat necessitatibus sunt recusandae rem, tempore blanditiis consectetur distinctio nostrum enim sit corporis non odio deleniti architecto. Corporis, nam assumenda. Quibusdam, perspiciatis!</p>
<p>Illum, quasi nisi animi. Expedita recusandae nam maxime architecto, illo a? Aspernatur numquam eveniet quisquam, inventore fugit amet voluptatem porro odio corporis obcaecati nostrum earum aliquam recusandae, sint necessitatibus rem.</p>
<p>Id praesentium vitae tenetur harum voluptate error adipisci dignissimos vero voluptatibus numquam quibusdam, nemo molestias alias aliquam, est, esse at fugiat quasi ducimus ratione! Inventore, eaque repudiandae sed magnam incidunt!</p>
<p>Aliquid in, veritatis ut! Veritatis, voluptatibus? Fugiat iusto officia repellat quasi dolore eum odio vitae inventore error debitis, doloribus facilis, itaque! Perspiciatis iste, incidunt hic non qui voluptate rem quidem?</p>
<p>Explicabo laudantium quidem, ab aperiam autem tenetur quae voluptatem quam, mollitia recusandae sapiente id, praesentium quasi soluta tempora dolorum, maiores velit. Porro unde doloribus iste, nihil ipsa, pariatur molestias aliquam.</p>
<p>Aut excepturi vitae dicta, quos distinctio, nulla, nostrum architecto, atque veritatis perspiciatis voluptates odio. Similique nobis sed natus illo esse, quod quas ex tenetur dolore deserunt optio voluptate numquam quo.</p>
<p>Repudiandae inventore consequatur nisi ad ut voluptas pariatur ducimus consequuntur, exercitationem tenetur ipsam nesciunt beatae nostrum soluta similique excepturi perspiciatis consectetur illum veniam aut hic, neque eveniet. Nesciunt quas, placeat?</p>
<p>Unde nam, aut placeat. Voluptas, consequatur, quis. Perferendis illum ratione in voluptate consectetur molestias nam hic, reprehenderit similique distinctio. Repellendus veritatis excepturi hic dicta fuga mollitia! Culpa dolores doloribus, ratione.</p>
<p>Vero cupiditate quaerat sit non veritatis harum nesciunt eos suscipit tempore dolorem porro saepe a, iusto vitae, voluptatum debitis consectetur voluptas, corporis. Sequi, sint odio eligendi delectus culpa dignissimos, obcaecati?</p>
<p>Ipsam sequi facilis magnam ad officiis quae, nobis iusto, commodi culpa optio a facere numquam placeat perspiciatis saepe maxime mollitia voluptatem sunt ipsa? Sequi ipsam, nostrum blanditiis dicta repudiandae iste!</p>
<p>Facilis tenetur officia quo delectus eius quam vel minus quas nesciunt ipsa perferendis, explicabo quasi itaque, rem vero accusamus debitis quis pariatur blanditiis illo nostrum eum! Molestiae fuga eius, illum.</p>
<p>Accusantium, repellendus soluta modi animi cumque error, nemo doloremque. Commodi voluptates distinctio nesciunt animi a, odio assumenda exercitationem amet reprehenderit libero expedita fugit. Id minus, corporis quibusdam cupiditate aut harum!</p>

Min-height flexbox container

I want to center the content inside container horizontally. I used the min-height & flexbox, but in Internet Explorer this solution doesn't work. I can't use simple height, because:
the layout are responsive
content can have different lengths
In the case, where the content will be longer that container, the layout will be break (when using height - so I must using min-height...)
I prepare a small demo with 'hack' for the IE:
http://jsfiddle.net/pujceaam
HTML
<div id="content" class="flex-center">
<div id="content2">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Ullam fugit eum modi aspernatur dicta, similique. Cupiditate sapiente at facilis tempore assumenda, eaque inventore veritatis aperiam et tenetur aliquam totam quo sequi dolor illo est amet quibusdam repellat, sed eius voluptate, a repudiandae molestiae asperiores! Alias omnis aperiam nam perferendis maiores quae minus repellat similique repellendus dolor quos magnam, labore architecto quasi vitae cumque officiis adipisci exercitationem autem eius fugiat. Velit nesciunt, excepturi neque. Perspiciatis delectus, autem rerum soluta esse, nulla necessitatibus repellat ducimus ex eligendi culpa! Iusto, repellat hic aliquam sit illum tempore, adipisci modi? At doloribus, illum quod perferendis ab dolorum aut, itaque laborum, voluptates nihil ea. Quia molestias tempore repudiandae pariatur laudantium ut velit inventore, consectetur distinctio officia deserunt laborum natus sunt voluptates alias corrupti veniam tempora exercitationem, fugiat aliquam provident soluta. Provident repellat odit totam aliquam culpa distinctio voluptas expedita ipsa deleniti quasi nesciunt qui eius esse iste debitis vitae ad soluta dolorem, amet, optio aperiam ullam. Dolorem ab dolores veniam, dolore, asperiores adipisci enim maiores quas accusantium porro consectetur sapiente officia exercitationem doloremque neque aperiam hic impedit nihil inventore alias ullam voluptatem soluta earum quisquam. Obcaecati, sapiente, at. Obcaecati eius ex, delectus! Atque, ullam et vitae.</div>
CSS
.flex-center {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
background: rgba(125, 125, 125, .5);
min-height: calc(100vh - 100px);
}
.va-parent {
width: 100%;
display: table;
}
.va-children {
display: table-cell;
vertical-align: middle;
}
JS
$(function () {
//detect IE
var isIE = (window.navigator.msPointerEnabled) || (document.all && document.addEventListener && !window.atob);
//old method to vertical align content
function flexible() {
var c1 = $('#content'),
c2 = $('#content2');
if (c1.height() > c2.height()) {
c1.addClass('va-parent');
c2.addClass('va-children');
}
}
//apply old method if IE
if (isIE) flexible();
});
But I don't know if it's a good solution?
Or maybe someone has another idea?
EDIT:
In content can be grids, images, tables, lists etc. content - not only a text :)
Truncate String with Ellipsis
.truncate {
width: 250px;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}