I' m trying to get a responsive title + columns with images - html

I'm new to this and this is the first web page I'm trying to create. By far I managed to create 3 columns and make them responsive. But the <h2> + <p> are bothering me. I'm trying to push them above the images when displayed on smartphone/tablet screens.
What should I use?
body, html {
height: 100%;
margin: 0;
}
.hero-image {
background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3)), url(images/sanGalgano.jpg);
height: 70%;
text-align: center;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
}
.hero-text {
font-family: 'Bungee Outline', cursive;
font-size: 2rem;
display: inline-block;
text-align: left;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
}
.logo {
text-align: center;
position: absolute;
display: inline-block;
top: 43%;
left: 56%;
width: 45%;
}
/* 3 circles panel */
.container {
background-color: #1F3740;
display: inline-flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
}
.box img {
width: 70%;
height: auto;
border-radius: 50%;
padding-top: 1.5rem;
}
.box {
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
max-width: 25rem;
min-width: 18rem;
margin: 60px;
text-align: center;
}
.box.description {
margin-top: 0;
}
h2 {
font-family: 'Nothing You Could Do', cursive;
font-size: 3rem;
color: #d4af37;
display: inline-block;
clear: left;
}
p {
font-family: 'Quicksand', sans-serif;
color: #A0C9D9;
font-size: 2rem;
text-align: center;
}
/* 3 columns panel */
.container2 {
display: flex;
flex-wrap: wrap;
justify-content: flex-end;
padding: 0 4px;
position: relative;
}
.column {
flex: 20%;
max-width: 20%;
padding: 0 4px;
}
.column img {
margin-top: 8px;
vertical-align: middle;
width: 100%;
border-radius: 30%;
}
.descrizione {
position: absolute;
top: 30%;
right: 70%;
text-align: center;
}
.descrizione p {
color: #1F3740;
}
<div class="hero-image">
<div class="hero-text">
<h1>Francesco <br> Gallo <br> Fotografo</h1>
<div>
<img class="logo" src="images/logo2.png" alt="">
</div>
</div>
</div>
<div class="container">
<div class="box">
<img src="images/torta.png">
</div>
<div class="box">
<img src="images/bacio.jpg">
</div>
<div class="box">
<img src="images/amiche.png">
</div>
<div class="box description">
<h2>Per i vostri momenti speciali</h2>
<p>Lorem ipsum dolor sit amet <br>consectetur adipisicing elit.<br> Similique molestias hic velit,<br> ipsum facere nemo minus distinctio <br> est quidem neque.
</p>
</div>
</div>
<div class="container2">
<div class="descrizione">
<h2>Ciao, sono Francesco!</h2>
<p>Lorem ipsum dolor sit amet <br>consectetur adipisicing elit.<br> Similique molestias hic velit,<br> ipsum facere nemo minus distinctio <br> est quidem neque.
</p>
</div>
<div class="column">
<img src="images/torta.png">
<img src="images/abbraccio.png">
</div>
<div class="column">
<img src="images/vestito.png">
<img src="images/amiche.png">
</div>
<div class="column">
<img src="images/bacio.jpg">
<img src="images/bolle3.png">
</div>
</div>

Related

Hero image with overlapping text box content appearing behind text box. How can I fix without using media queries?

I have a hero image that has a text box overlapping the hero a little bit but when I add any content below the box it appears under the text box. Some media queries are added in my code below and it works but I feel like there has to be a way to contain the hero and overlapping text box into its own section. If had to add more text I'd have to go through and adjust all of the media queries to make it look good again so how can I achieve this without using media queries?
Here is my code:
.shell {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
/* overlap */
.shell:before {
content: "";
background-image: url(https://i.ibb.co/x866XdV/test-hero.jpg);
background-repeat: no-repeat;
background-size: cover;
background-position: bottom;
position: relative;
height: 300px;
width: 100%;
}
.shell-header {
color: #fff;
padding: 0px 20px;
}
.shell-body {
padding: 20px;
border-radius: 10px;
box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.25);
background-color: #fff;
max-width: 85%;
position: absolute;
top: 80%;
}
img {
width: 20%;
height: 20%;
display: block;
margin-left: auto;
margin-right: auto;
}
body {
margin: 0;
font-family: sans-serif;
}
.wrapper {
padding-top: 12rem;
}
#media only screen and (min-width: 800px) {
.wrapper {
padding-top: 8rem;
}
}
#media only screen and (max-width: 360px) {
.wrapper {
padding-top: 11rem;
}
}
<div class="shell">
<div class="shell-header"></div>
<div class="shell-body">
<h1>Title</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Placeat vel ducimus illo consectetur commodi ex nulla aut amet ipsum maiores itaque, iusto quam mollitia facilis consequatur tempora neque quod eligendi?</p>
</div>
</div>
<div class="wrapper">
<img src="https://upload.wikimedia.org/wikipedia/commons/3/3f/Placeholder_view_vector.svg" alt="">
</div>
Using padding is ideal. But you can play around with the positioning of your elements. For instance, you can set body to position: relative; & then nest .wrapper within .shell and set .wrapper to position: absolute;.
.shell {
display: flex;
flex-direction: column;
align-items: center;
}
/* overlap */
.shell:before {
content: "";
background-image: url(https://i.ibb.co/x866XdV/test-hero.jpg);
background-repeat: no-repeat;
background-size: cover;
background-position: bottom;
position: relative;
height: 300px;
width: 100%;
}
.shell-header {
color: #fff;
padding: 0px 20px;
}
.shell-body {
padding: 20px;
border-radius: 10px;
box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.25);
background-color: #fff;
max-width: 85%;
position: absolute;
top: 80%;
}
img {
width: 20%;
height: 20%;
display: block;
margin-left: auto;
margin-right: auto;
}
body {
margin: 0;
font-family: sans-serif;
position: relative;
}
.wrapper {
position: absolute;
bottom: -80%;
}
<div class="shell">
<div class="shell-header"></div>
<div class="shell-body">
<h1>Title</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Placeat vel ducimus illo consectetur commodi ex nulla aut amet ipsum maiores itaque, iusto quam mollitia facilis consequatur tempora neque quod eligendi?</p>
</div>
<div class="wrapper">
<img src="https://upload.wikimedia.org/wikipedia/commons/3/3f/Placeholder_view_vector.svg" alt="">
</div>
</div>
Example using negative margin.
.shell {
display: flex;
flex-direction: column;
align-items: center;
}
/* overlap */
.shell:before {
content: "";
background-image: url(https://i.ibb.co/x866XdV/test-hero.jpg);
background-repeat: no-repeat;
background-size: cover;
background-position: bottom;
position: relative;
height: 300px;
width: 100%;
}
.shell-header {
color: #fff;
padding: 0px 20px;
}
.shell-body {
padding: 20px;
border-radius: 10px;
box-shadow: 0px 0px 20px rgba(0, 0, 0, 0.25);
background-color: #fff;
max-width: 85%;
margin-top: -6.375rem;
position: relative;
z-index: 1;
}
img {
width: 20%;
height: 20%;
display: block;
margin-left: auto;
margin-right: auto;
}
body {
margin: 0;
font-family: sans-serif;
position: relative;
}
.wrapper {
margin-top: 1em;
}
<div class="shell">
<div class="shell-header"></div>
<div class="shell-body">
<h1>Title</h1>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Placeat vel ducimus illo consectetur commodi ex nulla aut amet ipsum maiores itaque, iusto quam mollitia facilis consequatur tempora neque quod eligendi?</p>
</div>
</div>
<div class="wrapper">
<img src="https://upload.wikimedia.org/wikipedia/commons/3/3f/Placeholder_view_vector.svg" alt="">
</div>

How can I set height=100% without any content in css?

sorry for my English...
I want to make sidebar 100% height of the page. I set html:100% and then height: 100%. but as you see in screenshot the sidebar does not working. and the height is equal to the height of content inside that.
this is css code i wrote for that. I also use viewpoints for sidebar..............
html {
box-sizing: border-box;
height: 100%;
}
*,
*::before,
*::after {
margin: 0;
padding: 0;
box-sizing: inherit;
}
body {
font-family: Tahoma, sans-serif;
}
body p {
font-family: 'Trebuchet MS', sans-serif;
}
.main {
width: 80%;
height: 100%;
background-color: #243E36;
color: #F1F7ED;
float: left;
position: relative;
}
header {
text-align: center;
margin: 20px auto;
border-bottom: 2px solid #E0EEC6;
width: 30%;
padding-bottom: 15px;
}
header h1 {
color: #C2A83E;
}
header p {
margin-top: 10px;
text-transform: uppercase;
word-spacing: 10px;
letter-spacing: 5px;
}
section {
color: #212121;
padding: 0 20px;
}
article {
width: 50%;
margin-bottom: 30px;
float: left;
}
article h2 {
padding: 15px;
}
article p {
text-align: justify;
padding: 0 15px;
}
footer {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
background-color: #7CA982;
text-align: center;
}
aside {
width: 20%;
min-height: 100%;
max-height: 100%;
background-color: #E0EEC6;
float: left;
}
.group:before,
.group:after {
content: "";
display: table;
}
.group:after {
clear: both;
}
.group {
zoom: 1;
}
<body>
<div class="container group">
<div class="main">
<!-- Header -->
<header>
<h1>My Personal NoteBook</h1>
<p>Welcome to my page</p>
</header>
<!-- Notes -->
<section class="group">
<article>
<h2>Title 1</h2>
<p>Posted on 2020/07/23</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Dolorum, sequi iusto! Facere, quos
tempore veritatis sit ratione iste perferendis quod possimus voluptatem, quam, non similique
labore quas adipisci corporis libero!</p>
</article>
</section>
<!-- Footer -->
<footer>
<p>©2020 My Nootbook</p>
</footer>
</div>
<!-- Sidebar -->
<aside style="height:100vh;">
<h1>SideBar</h1>
</aside>
</div>
</body>
One way you can do this is by using inline CSS in your sidebar div element
`
<div class="sidenav" style="height:100vh;position: fixed;">
About
Services
Clients
Contact
</div>"
`
I hope this example will give you a better idea.
You issues is you have used 2 floats elements, and float elements won't respect height:100%.
Solution #1: Float 1 div, and another using margin-left
html,body {
height: 100%;
}
.c-container {
height: 100%;
}
.c-content {
float: left;
width: 80%;
}
.c-sidebar {
margin-left: 80%;
height: 100%;
background: red;
}
<div class="c-container">
<div class="c-content ">
content
</div>
<div class="c-sidebar">
sidebar
</div>
</div>
Flex solution:
html,body {
height: 100vh;
}
.c-container {
display: flex;
height: 100%;
}
.c-content {
flex: 1 1 auto;
}
.c-sidebar {
width: 200px;
background: red;
}
<div class="c-container">
<div class="c-content ">
content
</div>
<div class="c-sidebar">
sidebar
</div>
</div>

I am trying to center my grid of projects but there is margin, or extra space that i can get rid of to the right of the page. How do I fix this?

In my project section for my portfolio site all the sections are responsive, but my project section is off on larger screen sizes and there is extra space to the right Ive tried removing margins but it is still there how can I remove this and center the container?
here is the problem in my dev tools
#projects {
text-align: center;
}
#projects .grid {
display: grid;
grid-template-columns: repeat(2, 1fr);
grid-gap: 10px;
}
#projects .grid .container {
text-align: center;
}
#projects .container {
margin: 0;
position: relative;
}
#projects .container .box {
position: relative;
margin: 40px auto;
width: 250px;
height: 120px;
overflow: hidden;
background:red;
transition: 0.5s;
}
#projects .container .box:hover {
z-index: 1;
transform: scale(1.25);
box-shadow: 0 25px 40px rgba(0, 0, 0, 0.5);
}
#projects .container .box .imgbx {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
#projects .container .box .imgbx:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
background: linear-gradient(180deg, #1a75ff, #000);
mix-blend-mode: multiply;
opacity: 0;
transition: 0.5s;
}
#projects .container .box:hover .imgbx:before {
opacity: 1;
}
#projects .container .box .imgbx img {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
#projects .container .box .box-content {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 2;
display: flex;
padding: 10px;
align-items: flex-end;
}
#projects .container .box .box-content h3 {
color: #fff;
transition: 0.5s;
text-transform: uppercase;
margin-bottom: 2px;
font-size: 14px;
transform: translateY(200px);
}
#projects .container .box:hover .box-content h3 {
transform: translateY(0);
transition-delay: 0.6s;
}
#projects .container .box .box-content p {
color: #fff;
transform: translateY(200px);
transition: 0.5s;
font-size: 10px;
}
#projects .container .box:hover .box-content p {
transform: translateY(0);
transition-delay: 0.7s;
}
<section id="projects">
<h2 class="content-title">Recent Work</h2>
<div class="grid container">
<div class="box">
<div class="imgBx">
<img class="projectImg" src="project-images/gadue.png" id="img1" alt="">
</div>
<div class="box-content">
<div>
<h3>Gadue</h3>
<p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Cupiditate, blanditiis?</p>
</div>
</div>
</div>
<div class="box">
<div class="imgBx">
<img class="projectImg" src="project-images/myherohome.png" id="img2" alt="">
</div>
<div class="box-content">
<div>
<h3>My Hero Wiki</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Aperiam, natus.</p>
</div>
</div>
</div>
<div class="box">
<div class="imgBx">
<img src="project-images/stockapphome.png" alt="">
</div>
<div class="box-content">
<div>
<h3>TheStockApp</h3>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Adipisci, aspernatur.</p>
</div>
</div>
</div>
<div class="box">
<div class="imgBx">
<img class="projectImg" src="project-images/blackjack.png" id="img4" alt="">
</div>
<div class="box-content">
<div>
<h3>blackjack game</h3>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Iste, fuga.</p>
</div>
</div>
</div>
</div>
</section>
Why you doesnt use the grid from bootstrap ? You can fix this with that. Or you can try to give your grid container a margin like this
#projects .grid{
margin: 0 auto;
}

Trouble centring text over an image in a flexbox page layout

I have tired a few of the different solutions on here but I can't get anything to work. So I was wondering if anyone had any other ideas.
I have created a the makings of a webpage using flexbox to lay everything out so it is nice and responsive.
However I am stuck, in one of my flexbox containers I would like to have a image centred with text centred over the top of that.
This container is the "container-stack pink" container with the "bulb" img and text
Here is a link to a codepen of my webpage. I have added placeholder images and havent copied any of the Javascript in as it isnt really import for the layout
Thanks for any help/suggestions in advance...
<html>
<head>
<link rel="stylesheet" href="https://use.typekit.net/nqr5bmw.css">
</head>
<body>
<div class="container green">
<div class="right-side">
<img id="raw-logo" src="http://via.placeholder.com/300x100" alt="raw-logo">
</div>
<div class="centered mash">
<img id="mash-logo" src="http://via.placeholder.com/700x500" alt="mash-up-img">
</div>
</div>
<div class="container pink">
<div class="centered fancy-header">
<p id="fancy-text1">Bacon ipsum<br>dolor amet</p>
</div>
<div class="centered fancy-body">
<p id="fancy-text2">Bacon ipsum dolor amet tail pancetta ribeye<br>beef turkey ball tip.</p>
</div>
<div class="centered scroll">
<p id="fancy-text3">keep scrolling</p>
button here
</div>
</div>
<div class="container-row blue">
<img id="masher" src="http://via.placeholder.com/700x500" alt="masher-img">
<div id="brief-text">
<p><span id="header">bacon</span><br><span id="subheader">in short...</span></p>
<p class="body">tasty</p>
<p class="body">Bacon ipsum Bacon ipsum Bacon ipsum<br>Bacon ipsum Bacon ipsum Bacon ipsum Bacon ipsum<br>amet tail pancetta ribeye</p>
</div>
</div>
<div class="container-stack pink">
<div id="wrapper">
<img id="bulb" src="http://via.placeholder.com/500x300" alt="bulb-img">
<div id="bulb-text">
<p>Bacon ipsum dolor amet<br>tail pancetta ribeye beef<br>turkey ball tip.</p>
<p>Andouille prosciutto<br>ground round jowl jerky.</p>
</div>
</div>
</div>
<div class="container generator">
<div class="centered text">
<div class="word-1">Peanut Butter</div>
<div class="word-2">Water Lily Seeds</div>
</div>
<div class="centered">
<button class="button">Mash!</button>
</div>
</div>
</body>
</html>
CSS:
body {
font-family: bebas-neue-by-fontfabric;
font-weight: 700;
text-align: center;
text-transform: uppercase;
background-color: black;
width: 100%;
height: 100%;
margin: 0;
}
.blue {
background-color: skyblue;
}
.pink {
background-color: pink;
}
.green {
background-color: chartreuse;
}
.container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
align-items: flex-start;
width: 100%;
margin: 0;
padding: 0;
}
.container-row {
display: flex;
flex-direction: row;
justify-content: center;
width: 100%;
margin: 0;
padding: 0;
}
.container-stack {
display: flex;
justify-content: center;
width: 100%;
margin: 0;
padding: 0;
}
.centered {
flex: 0 0 100%;
align-self: center;
}
.right-side {
border: 1px solid blue;
flex: 0 0 100%;
align-self: flex-end;
}
.left-side {
border: 1px solid orange;
flex: 0 0 100%;
align-self: flex-start;
}
#raw-logo {
width: 13.3vw;
max-width: 150px;
}
#mash-logo {
width: 80%;
margin-left: 10%;
margin-right: 10%;
}
.fancy-header{
border: 1px solid blue;
font-size: 15vw;
}
.fancy-body {
border: 1px solid red;
font-size: 3vw;
}
#fancy-text1 {
margin: 0;
}
#fancy-text2 {
margin-top: 7vw;
}
#masher {
width: 40%;
margin-left: 10%;
}
#brief-text {
margin-left: 5%;
margin-right: 10%;
align-self: center;
}
#header {
font-size: 11vw;
}
#subheader {
font-size: 5vw;
}
.body {
font-size: 2.5vw;
}
#wrapper {
position: relative;
}
#bulb {
width: 40%;
}
.container {
position: relative;
text-align: center;
color: black;
}
.centered {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<div class="container">
<img src="http://via.placeholder.com/500x300" alt="Snow" style="width:100%;">
<div class="centered">
<p>Bacon ipsum dolor amet<br>tail pancetta ribeye beef<br>turkey ball tip.</p>
<p>Andouille prosciutto<br>ground round jowl jerky.</p>
</div>
</div>
Perhaps there is a few way of doing it. If your image is big enought and you don't want to make it as background you could do something like that
#bulb-text{
position: absolute;
top: 50%;
left: 50%;
display: inline-block;
transform: translateX(-50%) translateY(-50%);
}
Why don't you just use background images?
body {
font-family: bebas-neue-by-fontfabric;
font-weight: 700;
text-align: center;
text-transform: uppercase;
background-color: black;
width: 100%;
height: 100%;
margin: 0;
}
.blue {
background-color: skyblue;
}
.pink {
background-color: pink;
}
.green {
background-color: chartreuse;
}
.container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
align-items: flex-start;
width: 100%;
margin: 0;
padding: 0;
}
.container-row {
display: flex;
flex-direction: row;
justify-content: center;
width: 100%;
margin: 0;
padding: 0;
}
.container-stack {
display: flex;
justify-content: center;
width: 100%;
margin: 0;
padding: 0;
}
.centered {
flex: 0 0 100%;
align-self: center;
}
.right-side {
border: 1px solid blue;
flex: 0 0 100%;
align-self: flex-end;
}
.left-side {
border: 1px solid orange;
flex: 0 0 100%;
align-self: flex-start;
}
#raw-logo {
width: 13.3vw;
max-width: 150px;
}
#mash-logo {
width: 80%;
margin-left: 10%;
margin-right: 10%;
}
.fancy-header{
border: 1px solid blue;
font-size: 15vw;
}
.fancy-body {
border: 1px solid red;
font-size: 3vw;
}
#fancy-text1 {
margin: 0;
}
#fancy-text2 {
margin-top: 7vw;
}
#masher {
width: 40%;
margin-left: 10%;
}
#brief-text {
margin-left: 5%;
margin-right: 10%;
align-self: center;
}
#header {
font-size: 11vw;
}
#subheader {
font-size: 5vw;
}
.body {
font-size: 2.5vw;
}
#wrapper {
position: relative;
}
#bulb {
width: 40%;
}
.container-stack #wrapper{
background-image:url("http://via.placeholder.com/500x300");
background-size:cover;
background-position:center;
padding: 3vw;
}
<html>
<head>
<link rel="stylesheet" href="https://use.typekit.net/nqr5bmw.css">
</head>
<body>
<div class="container green">
<div class="right-side">
<img id="raw-logo" src="http://via.placeholder.com/300x100" alt="raw-logo">
</div>
<div class="centered mash">
<img id="mash-logo" src="http://via.placeholder.com/700x500" alt="mash-up-img">
</div>
</div>
<div class="container pink">
<div class="centered fancy-header">
<p id="fancy-text1">Bacon ipsum<br>dolor amet</p>
</div>
<div class="centered fancy-body">
<p id="fancy-text2">Bacon ipsum dolor amet tail pancetta ribeye<br>beef turkey ball tip.</p>
</div>
<div class="centered scroll">
<p id="fancy-text3">keep scrolling</p>
button here
</div>
</div>
<div class="container-row blue">
<img id="masher" src="http://via.placeholder.com/700x500" alt="masher-img">
<div id="brief-text">
<p><span id="header">bacon</span><br><span id="subheader">in short...</span></p>
<p class="body">tasty</p>
<p class="body">Bacon ipsum Bacon ipsum Bacon ipsum<br>Bacon ipsum Bacon ipsum Bacon ipsum Bacon ipsum<br>amet tail pancetta ribeye</p>
</div>
</div>
<div class="container-stack pink">
<div id="wrapper">
<div id="bulb-text">
<p>Bacon ipsum dolor amet<br>tail pancetta ribeye beef<br>turkey ball tip.</p>
<p>Andouille prosciutto<br>ground round jowl jerky.</p>
</div>
</div>
</div>
<div class="container generator">
<div class="centered text">
<div class="word-1">Peanut Butter</div>
<div class="word-2">Water Lily Seeds</div>
</div>
<div class="centered">
<button class="button">Mash!</button>
</div>
</div>
</body>
</html>
I have added some padding to the Wrapper so the text is not so bunched to the end of the tag.
.container-stack #wrapper{
background-image:url("http://via.placeholder.com/500x300");
background-size:cover;
background-position:center;
padding: 3vw;
}
...I would like to have a[sic] image centred[sic] with text centred[sic] over the top of that.
The following changes should move the text above image and keep it centered.
#wrapper {
...
display: flex;
flex-direction: column-reverse;
align-items: center;
}
body {
font-family: bebas-neue-by-fontfabric;
font-weight: 700;
text-align: center;
text-transform: uppercase;
background-color: black;
width: 100%;
height: 100%;
margin: 0;
}
.blue {
background-color: skyblue;
}
.pink {
background-color: pink;
}
.green {
background-color: chartreuse;
}
.container {
display: flex;
flex-direction: column;
flex-wrap: wrap;
align-items: flex-start;
width: 100%;
margin: 0;
padding: 0;
}
.container-row {
display: flex;
flex-direction: row;
justify-content: center;
width: 100%;
margin: 0;
padding: 0;
}
.container-stack {
display: flex;
justify-content: center;
width: 100%;
margin: 0;
padding: 0;
}
.centered {
flex: 0 0 100%;
align-self: center;
}
.right-side {
border: 1px solid blue;
flex: 0 0 100%;
align-self: flex-end;
}
.left-side {
border: 1px solid orange;
flex: 0 0 100%;
align-self: flex-start;
}
#raw-logo {
width: 13.3vw;
max-width: 150px;
}
#mash-logo {
width: 80%;
margin-left: 10%;
margin-right: 10%;
}
.fancy-header{
border: 1px solid blue;
font-size: 15vw;
}
.fancy-body {
border: 1px solid red;
font-size: 3vw;
}
#fancy-text1 {
margin: 0;
}
#fancy-text2 {
margin-top: 7vw;
}
#masher {
width: 40%;
margin-left: 10%;
}
#brief-text {
margin-left: 5%;
margin-right: 10%;
align-self: center;
}
#header {
font-size: 11vw;
}
#subheader {
font-size: 5vw;
}
.body {
font-size: 2.5vw;
}
#wrapper {
position: relative;
display: flex;
flex-direction: column-reverse;
align-items: center;
}
#bulb {
width: 40%;
}
<html>
<head>
<link rel="stylesheet" href="https://use.typekit.net/nqr5bmw.css">
</head>
<body>
<div class="container green">
<div class="right-side">
<img id="raw-logo" src="http://via.placeholder.com/300x100" alt="raw-logo">
</div>
<div class="centered mash">
<img id="mash-logo" src="http://via.placeholder.com/700x500" alt="mash-up-img">
</div>
</div>
<div class="container pink">
<div class="centered fancy-header">
<p id="fancy-text1">Bacon ipsum<br>dolor amet</p>
</div>
<div class="centered fancy-body">
<p id="fancy-text2">Bacon ipsum dolor amet tail pancetta ribeye<br>beef turkey ball tip.</p>
</div>
<div class="centered scroll">
<p id="fancy-text3">keep scrolling</p>
button here
</div>
</div>
<div class="container-row blue">
<img id="masher" src="http://via.placeholder.com/700x500" alt="masher-img">
<div id="brief-text">
<p><span id="header">bacon</span><br><span id="subheader">in short...</span></p>
<p class="body">tasty</p>
<p class="body">Bacon ipsum Bacon ipsum Bacon ipsum<br>Bacon ipsum Bacon ipsum Bacon ipsum Bacon ipsum<br>amet tail pancetta ribeye</p>
</div>
</div>
<div class="container-stack pink">
<div id="wrapper">
<img id="bulb" src="http://via.placeholder.com/500x300" alt="bulb-img">
<div id="bulb-text">
<p>Bacon ipsum dolor amet<br>tail pancetta ribeye beef<br>turkey ball tip.</p>
<p>Andouille prosciutto<br>ground round jowl jerky.</p>
</div>
</div>
</div>
<div class="container generator">
<div class="centered text">
<div class="word-1">Peanut Butter</div>
<div class="word-2">Water Lily Seeds</div>
</div>
<div class="centered">
<button class="button">Mash!</button>
</div>
</div>
</body>
</html>

How to center text vertically in flexbox with image stick to the bottom?

I have 3 column grid with images using flexbox. The issue I encountered is how to properly put smaller image in the middle column to the bottom and the center text vertically in the rest space using flexbox.
I have very ugly solution, which quite unresponsive, so I sure the is better solution for this. Read some articles and watch 3 video courses about flexbox, but didn't found a case with such situation.
Also tried to make smaller image absolute, but then I couldn't center text vertically as I wanted.
Would be grateful for any suggestions.
.container{
max-width: 90%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
}
img {
width: 100%;
height: 100%;
display: block;
}
.fe2{
flex: 1;
text-align: center;
}
.flex-cont-inner {
display: flex;
flex-flow: column;
height: 100%;
}
.flex-cont-inner img {
height: initial;
}
.message{
font-size: 2.3vw;
margin: 0 auto;
}
.message p {
color: blue;
font-size: 2vw;
max-width: 80%;
margin: 0 auto;
padding: 34.5% 0px;
}
.author{
position: relative;
}
.author:after{
content: 'ANONYMUS';
position: absolute;
font-size: 1vw;
color:red;
top: 140%;
}
<div class="container">
<div class="fe2">
<img src="http://lorempixel.com/output/nightlife-h-c-500-700-3.jpg" alt="">
</div>
<div class="fe2 no-end">
<div class="flex-cont-inner">
<div class="message">
<p>Lorem ipsum dolor sit amet, consecte adipng elit. Voluptas doloremque dig<span class="author">nissimos </span>repreh!</p>
</div>
<img src="http://lorempixel.com/output/city-q-c-500-200-4.jpg" alt="">
</div>
</div>
<div class="fe2">
<img src="http://lorempixel.com/output/nightlife-h-c-500-700-2.jpg" alt="">
</div>
</div>
You need to use margin-top: auto; in both your message and your image. There's a really good explanation by Michael_B here about the use of auto margins with flexbox.
jsFiddle
CODE SNIPPET:
.container {
max-width: 90%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
}
img {
width: 100%;
height: 100%;
display: block;
}
.fe2 {
flex: 1;
text-align: center;
}
.flex-cont-inner {
display: flex;
flex-flow: column;
height: 100%;
}
.flex-cont-inner img {
height: initial;
margin-top: auto;
}
.message {
font-size: 2.3vw;
margin-top: auto;
}
.message p {
color: blue;
font-size: 2vw;
}
.author {
position: relative;
}
.author:after {
content: 'ANONYMUS';
position: absolute;
font-size: 1vw;
color: red;
top: 140%;
}
<div class="container">
<div class="fe2">
<img src="http://lorempixel.com/output/nightlife-h-c-500-700-3.jpg" alt="">
</div>
<div class="fe2 no-end">
<div class="flex-cont-inner">
<div class="message">
<p>Lorem ipsum dolor sit amet, consecte adipng elit. Voluptas doloremque dig<span class="author">nissimos </span>repreh!</p>
</div>
<img src="http://lorempixel.com/output/city-q-c-500-200-4.jpg" alt="">
</div>
</div>
<div class="fe2">
<img src="http://lorempixel.com/output/nightlife-h-c-500-700-2.jpg" alt="">
</div>
</div>