In my code below, .content
has flex properties, but on small screen looks cut out.
I wouldn't like to set fixed size because the text can become even bigger.
Basically, the background image should go full height on big screens while textual content on the right is in center.
On small screens the text should be first and normally visible while background goes after it.
How to solve this on smaller screen so that content is normally visible and pushes background after it? Here is the example https://codepen.io/anon/pen/YEdjQb?editors=1100 (adjust screen)
html, body, .wrapper {
height: 100%;
padding: 0;
margin: 0;
}
.wrapper {
display: flex;
flex-direction: column;
flex-wrap: wrap;
height: 100%;
}
.background {
background: url('http://via.placeholder.com/800x600') no-repeat center center/cover;
display: flex;
flex: 1;
order: 2;
}
.content {
flex: 1;
order: 1;
padding: 3em;
text-align: center;
display: flex;
flex-direction: column;
justify-content: center;
height: 100%;
}
@media screen and (min-width: 768px) {
.wrapper {
flex-direction: row;
}
.background {
order: 1;
}
.content {
order: 2;
}
}