Max-width on Internet Explorer - html

I'm having trouble getting max-width to work in IE. Is there a way to get max-width to work on IE?
This is what it looks like on other browsers:
enter image description here
This is what it looks like on IE:
enter image description here
here's HTML code
<div class="grid menu-content" id="menu1-content">
<article>
<div class="photo" style="background-image: url(img/test.jpg);">
</div>
<div class="text">
<div class="company-name">Name</div>
<div class="company-description">Basdfasdfasdf
</div>
</div>
<div class="founders">
<div class="founder">
<div class="picture"><img src="img/test.jpg" alt="asdf"></div>
<div class="name">FIRSTNAME LASTNAME</div>
</div>
<div class="founder">
<div class="picture"><img src="img/test.jpg" alt="sdf"></div>
<div class="name">FIRSTNAME LASTNAME</div>
</div>
</div>
</article>
<article>
<div class="photo" style="background-image: url(img/test.jpg);"></div>
<div class="text">
<div class="company-name">name</div>
<div class="company-description">asdfasdf
</div>
</div>
<div class="founders">
<div class="founder">
<div class="picture"><img src="img/breadfinance-founder.jpg" alt="Bread Finance Founder JOSH ABRAMOWITZ
"></div>
<div class="name">BEN JIN
</div>
</div>
</div>
</article>
<article>
<div class="photo" style="background-image: url(img/test.jpg);"></div>
<div class="text">
<div class="company-name">asdfasdf</div>
<div class="company-description">asdfasdfasdf
</div>
</div>
<div class="founders">
<div class="founder">
<div class="picture"><img src="img/test.jpg" alt="asdf"></div>
<div class="name">KATIE KIM</div>
</div>
</div>
</article>
<article>
<div class="photo" style="background-image: url(img/test.jpg);"></div>
<div class="text">
<div class="company-name">asdfasdf</div>
<div class="company-description">asdfasdf
</div>
</div>
<div class="founders">
<div class="founder">
<div class="picture"><img src="img/test.jpg" alt="asdfasdf"></div>
<div class="name">DEBBIE KIM</div>
</div>
</div>
</article>
</div>
here's CSS
.name {
font-size: 12px;
letter-spacing: 2.2px;
margin-left: 17px;
}
.founder img {
width: 22px;
}
.founder {
margin-bottom: -5px;
}
article .picture {
max-width: 22px;
}
.
.company-name {
margin-top: 20px;
margin-bottom: 1px;
font-size: 22.5px;
}
.company-description {
font-size: 21px;
line-height: 1.8;
letter-spacing: 0.5px;
margin-bottom: 6px ;
}
.founders {
position: absolute;
}
.founder {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
margin, padding: 0px;
}
.name {
letter-spacing: 2.2px;
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
line-height: 1.6;
}
.picture {
-webkit-box-flex: 0;
-ms-flex: 0 0 22px;
flex: 0 0 22px;
margin: 0;
}
.founder img {
margin-top: 0;
margin-bottom: 0;
vertical-align: middle;
}
.founders {
top: 99%;
}
#media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
/* IE10+ CSS */
.grid article {
-ms-flex: 0 0 250px;
margin-right: 20px;
margin-bottom: 150px;
-ms-flex-pack: start;
}
.grid article {
-ms-flex: 0 0 250px;
margin-right: 20px;
margin-bottom: 150px;
-ms-flex-pack: start;
}
}
some more css that's probably not relevant
.grid {
display: -ms-flexbox;
-ms-flex-wrap: wrap;
display: grid;
-webkit-box-pack: start;
justify-content: start;
justify-content: space-between;
row-gap: 100px;
}
.grid article {
-ms-flex: 0 0 250px;
-ms-flex-pack: start;
}
.grid .photo {
width: 100%;
background-size: contain;
background-position: center;
}
.grid .photo:after {
content: "";
display: block;
padding-bottom: 100%;
}
.grid a {
display: block;
text-decoration: none;
color: inherit;
}
.grid article {
position: relative;
}
.grid {
grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
grid-row-gap: 100px;
grid-column-gap: 50px;
}

It looks like you have created this new thread for the same issue that you had asked for before.
I have tested the sample code and found that -ms-flex: 1; and flex: 1; in the .name class is causing this issue.
IE 11 has partial support for the Flex due to some known issues. This can be a possible reason for this issue.
The issue can be fixed by commenting or removing the flex from the .name class.
.name class:
.name {
letter-spacing: 2.2px;
-webkit-box-flex: 1;
/*-ms-flex: 1;
flex: 1;*/
line-height: 1.6;
}
Output:

Related

How to left align an image in a flex container?

I'm trying to get the image to appear on the left with content on the right.
desired output would be:
my images on the below appear above the content. I've tried a number of things with the flex-direction but just can't get the image to appear on the left.
here's my cut down code, any suggestions would be greatly appreciated.
<style>html {
background: #f5f7f8;
font-family: 'Roboto', sans-serif;
-webkit-font-smoothing: antialiased;
padding: 20px 0;
}
.band {
width: 90%;
max-width: 1240px;
margin: 0 auto;
display: grid;
grid-template-columns: 1fr;
grid-template-rows: auto;
grid-gap: 20px;
}
#media only screen and (min-width: 500px) {
.band {
grid-template-columns: 1fr 1fr;
}
.item-1 {
grid-column: 1/ span 2;
}
.item-1 h1 {
font-size: 30px;
}
}
#media only screen and (min-width: 850px) {
.band {
grid-template-columns: 1fr 1fr 1fr 1fr;
}
}
/* card */
.card {
min-height: 100%;
background: white;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: column;
text-decoration: none;
color: #444;
position: relative;
top: 0;
transition: all .1s ease-in;
}
.card:hover {
top: -2px;
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.2);
}
.card article {
padding: 20px;
display: flex;
flex: 1;
justify-content: space-between;
flex-direction: column;
}
.card .thumb {
padding-bottom: 60%;
background-size: cover;
background-position: center center;
}
.card p {
flex: 1;
/* make p grow to fill available space*/
line-height: 1.4;
}
/* typography */
h1 {
font-size: 20px;
margin: 0;
color: #333;
}
.card span {
font-size: 12px;
font-weight: bold;
color: #999;
text-transform: uppercase;
letter-spacing: .05em;
margin: 2em 0 0 0;
}
</style>
<div class="support-grid"></div>
<div class="band">
<div class="item-4">
<a href="#" class="card">
<div class="thumb" style="background-image: url(https://thumbs.dreamstime.com/z/positive-pension-happiness-money-saving-retirement-financia-positive-pension-happiness-money-saving-retirement-financial-118207382.jpg);"></div>
<article>
<h1>title</h1>
<p></p>
<span>content</span>
</article>
</a>
</div>
<div class="item-5">
<a href="#" class="card">
<div class="thumb" style="background-image: url(https://thumbs.dreamstime.com/z/positive-pension-happiness-money-saving-retirement-financia-positive-pension-happiness-money-saving-retirement-financial-118207382.jpg);"></div>
<article>
<h1>title</h1>
<p></p>
<span>content</span>
</article>
</a>
</div>
<div class="item-6">
<a href="#" class="card">
<div class="thumb" style="background-image: url(https://thumbs.dreamstime.com/z/positive-pension-happiness-money-saving-retirement-financia-positive-pension-happiness-money-saving-retirement-financial-118207382.jpg);"></div>
<article>
<h1>title</h1>
<p></p>
<span>content</span>
</article>
</a>
</div>
<div class="item-7">
<a href="#" class="card">
<div class="thumb" style="background-image: url(https://thumbs.dreamstime.com/z/positive-pension-happiness-money-saving-retirement-financia-positive-pension-happiness-money-saving-retirement-financial-118207382.jpg);"></div>
<article>
<h1>title</h1>
<p></p>
<span>content</span>
</article>
</a>
</div>
</div>
Change flex-direction: column; to flex-direction: row; on card. Then you just have to define a width for thumb because you are using it as a background image. So I set width: 100%; to thumb.
html {
background: #f5f7f8;
font-family: 'Roboto', sans-serif;
-webkit-font-smoothing: antialiased;
padding: 20px 0;
}
.band {
width: 90%;
max-width: 1240px;
margin: 0 auto;
display: grid;
grid-template-columns: 1fr;
grid-template-rows: auto;
grid-gap: 20px;
}
#media only screen and (min-width: 500px) {
.band {
grid-template-columns: 1fr 1fr;
}
.item-1 {
grid-column: 1/ span 2;
}
.item-1 h1 {
font-size: 30px;
}
}
#media only screen and (min-width: 850px) {
.band {
grid-template-columns: 1fr 1fr 1fr 1fr;
}
}
/* card */
.card {
min-height: 100%;
background: white;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
display: flex;
flex-direction: row;
flex-flow: row;
text-decoration: none;
color: #444;
position: relative;
top: 0;
transition: all .1s ease-in;
}
.card:hover {
top: -2px;
box-shadow: 0 4px 5px rgba(0, 0, 0, 0.2);
}
.card article {
padding: 20px;
display: flex;
flex: 1;
justify-content: space-between;
flex-direction: column;
}
.card .thumb {
padding-bottom: 60%;
background-size: cover;
background-position: center center;
}
.card p {
flex: 1;
/* make p grow to fill available space*/
line-height: 1.4;
}
/* typography */
h1 {
font-size: 20px;
margin: 0;
color: #333;
}
.card span {
font-size: 12px;
font-weight: bold;
color: #999;
text-transform: uppercase;
letter-spacing: .05em;
margin: 2em 0 0 0;
}
.thumb {
width: 100%;
}
<div class="support-grid"></div>
<div class="band">
<div class="item-4">
<a href="#" class="card">
<div class="thumb" style="background-image: url(https://thumbs.dreamstime.com/z/positive-pension-happiness-money-saving-retirement-financia-positive-pension-happiness-money-saving-retirement-financial-118207382.jpg);"></div>
<article>
<h1>title</h1>
<p></p>
<span>content</span>
</article>
</a>
</div>
<div class="item-5">
<a href="#" class="card">
<div class="thumb" style="background-image: url(https://thumbs.dreamstime.com/z/positive-pension-happiness-money-saving-retirement-financia-positive-pension-happiness-money-saving-retirement-financial-118207382.jpg);"></div>
<article>
<h1>title</h1>
<p></p>
<span>content</span>
</article>
</a>
</div>
<div class="item-6">
<a href="#" class="card">
<div class="thumb" style="background-image: url(https://thumbs.dreamstime.com/z/positive-pension-happiness-money-saving-retirement-financia-positive-pension-happiness-money-saving-retirement-financial-118207382.jpg);"></div>
<article>
<h1>title</h1>
<p></p>
<span>content</span>
</article>
</a>
</div>
<div class="item-7">
<a href="#" class="card">
<div class="thumb" style="background-image: url(https://thumbs.dreamstime.com/z/positive-pension-happiness-money-saving-retirement-financia-positive-pension-happiness-money-saving-retirement-financial-118207382.jpg);"></div>
<article>
<h1>title</h1>
<p></p>
<span>content</span>
</article>
</a>
</div>
</div>
Start by focusing on these two areas:
In your code, the flex container is set to flex-direction: column. This makes your image and the article (i.e., the flex items) stack vertically. Remove this column setting so that the items can line up in a row (which is the default setting).
The flex container will work better if you render the item with HTML (using the img tag) as opposed to CSS (using the background-image property). It will work even better if you wrap the img in a figure, div or other HTML element, as images seem to be problematic for some browsers when they're flex items. The common solution is to make the wrapper a flex item.
.card {
display: flex;
/* flex-direction: column; */
}
div {
width: 200px;
}
img {
width: 100%;
height: auto;
}
.card article {
padding: 20px;
}
<a href="#" class="card">
<div>
<img src="https://thumbs.dreamstime.com/z/positive-pension-happiness-money-saving-retirement-financia-positive-pension-happiness-money-saving-retirement-financial-118207382.jpg">
</div>
<article>
<h1>title</h1>
<p></p>
<span>content</span>
</article>
</a>
Setting the .card class flex-direction to this:
.card {
flex-direction: row;
}
and adding: flex: 1 0 1%; width:1%; to article and .thumb should get you started.

css, how to combine shape-outside and flex-wrap?

I'm trying to combine flex-wrap and shape-outside to get something like this :
What i want to do is : the blue zone to flex-wrap it's content, and to be on the right and bottom of the grey zone :
adding display: flex; break the shape-outside
Any tips ? thanks
A JSfiddle :
https://jsfiddle.net/81b3cLxf/
HTML
<div class="main">
<div class="left"></div>
<div class="flex-container wrap">
<div class="flex-item">1</div>
<div class="flex-item">2</div>
<div class="flex-item">3</div>
<div class="flex-item">4</div>
<div class="flex-item">5</div>
<div class="flex-item">6</div>
<div class="flex-item">7</div>
<div class="flex-item">8</div>
</div>
</div>
CSS
.main {
width: 600px;
height: 500px;
box-sizing: border-box;
overflow: hidden;
background-color: black;
padding: 10px;
}
.left {
width: 50%;
height: 200px;
background-color: lightgray;
shape-outside:"none";
float: left;
}
.flex-container {
height: 100%;
background-color: blue;
-ms-box-orient: horizontal;
display: -webkit-box;
display: -moz-box;
display: -ms-flexbox;
display: -moz-flex;
display: -webkit-flex;
display: flex;
}
.wrap {
-webkit-flex-wrap: wrap;
flex-wrap: wrap;
}
.flex-item {
background: tomato;
padding: 5px;
width: 75px;
height: 75px;
margin: 10px;
line-height: 75px;
color: white;
font-weight: bold;
font-size: 2em;
text-align: center;
}
Please check my example with grid:
.main {
width: 600px;
height: 500px;
box-sizing: border-box;
overflow: hidden;
background-color: black;
padding: 10px;
}
.left {
grid-column: span 3;
grid-row: span 2;
background-color: lightgray;
}
.flex-container {
height: 100%;
background-color: blue;
display: grid;
grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
grid-gap: 10px;
grid-auto-rows: 85px;
}
.flex-item {
background: tomato;
padding: 5px;
width: 75px;
height: 75px;
margin: 0;
color: white;
font-weight: bold;
font-size: 2em;
text-align: center;
display: flex;
align-items: center;
justify-content: center;
}
<div class="main">
<div class="flex-container wrap">
<div class="left"></div>
<div class="flex-item">1</div>
<div class="flex-item">2</div>
<div class="flex-item">3</div>
<div class="flex-item">4</div>
<div class="flex-item">5</div>
<div class="flex-item">6</div>
<div class="flex-item">7</div>
<div class="flex-item">8</div>
<div class="flex-item">9</div>
<div class="flex-item">10</div>
</div>
</div>

Flex direction column is ignored if one of the child has relative postion

I have the code below.
On the .container I set
display:flex;
flex-direction: column;
to make my previous and next arrow to go before and after the container items. It doesn't work the flex direction remains row.
.container {
margin: 0;
position: relative;
overflow: hidden;
border: 1px solid green;
display: flex;
flex-direction: column;
}
.items {
left: 0;
top: 0;
display: flex;
flex-direction: row;
padding: 0.5rem 0;
position: relative;
margin: 2px;
}
.item {
align-items: center;
display: flex;
height: 60px;
justify-content: center;
margin: 2px;
}
.item>* {
cursor: pointer;
display: flex;
max-height: 100%;
}
.item img {
display: block;
max-height: 100%;
}
.previous::before,
.next::before {
color: #9e9e9e;
font: 400 1.5rem/1 iconfont !important;
speak: none;
text-transform: none !important;
}
<div class="container">
<div class="previous">S</div>
<div class="items">
<div class="item">
<img src="https://via.placeholder.com/50">
</div>
<div class="item">
<img src="https://via.placeholder.com/50">
</div>
<div class="item">
<img src="https://via.placeholder.com/50">
</div>
<div class="item">
<img src="https://via.placeholder.com/50">
</div>
</div>
<div class="next">S</div>
</div>
Actually you need to remove flex-direction: column from .container, because you are trying to create a row by putting the arrows inline with the items
.container {
margin: 0;
position: relative;
overflow: hidden;
border: 1px solid green;
display: flex;
align-items: center
}
.items {
left: 0;
top: 0;
display: flex;
padding: 0.5rem 0;
position: relative;
margin: 2px;
flex: 1;
background: lightblue;
justify-content: center
}
.item {
align-items: center;
display: flex;
height: 60px;
justify-content: center;
margin: 2px;
}
.item>* {
cursor: pointer;
display: flex;
max-height: 100%;
}
.item img {
display: block;
max-height: 100%;
}
.previous::before,
.next::before {
color: #9e9e9e;
font: 400 1.5rem/1 iconfont !important;
speak: none;
text-transform: none !important;
}
<div class="container">
<div class="previous">S</div>
<div class="items">
<div class="item">
<img src="https://via.placeholder.com/50">
</div>
<div class="item">
<img src="https://via.placeholder.com/50">
</div>
<div class="item">
<img src="https://via.placeholder.com/50">
</div>
<div class="item">
<img src="https://via.placeholder.com/50">
</div>
</div>
<div class="next">S</div>
</div>

Need to stick DIV-2 at bottom of DIV-1, then hide it under DIV-1 on hover

Im kind of lost here.
I want my .div .sticker to be at the bottom of .div stick-to-me on hover
I have tried couple of approaches but never with the preferred results.
The main problem is that when the stick-to-me div gets hovered it somehow pushes the .sticker div down and only partially hides it.
You can see in this fiddle how my code is and how it looks for now. It is obvius that I'm not getting the wanted results.
Any help or advise would be great.
here is my html
.flex-row {
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
.flex-row:after,
.flex-row:before {
display: none;
}
#media (max-width: 767px) {
.flex-row {
display: block;
}
}
/* partners */
.mag-block {
padding: 7px 0 120px;
}
#media (max-width: 991px) {
.mag-block {
padding-bottom: 60px;
}
}
#media (max-width: 767px) {
.mag-block {
padding-bottom: 40px;
}
}
.mag-block .row {
margin-left: -8px;
margin-right: -8px;
}
.mag-block .row [class^="col-"] {
padding-left: 8px;
padding-right: 8px;
}
#media (max-width: 991px) {
.mag-block .row [class^="col-"] {
padding-bottom: 16px;
}
}
.mag-block .item {
background-color: #fff;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
border: 1px solid #d5d2d2;
text-decoration: none !important;
-webkit-flex-direction: column;
-moz-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
-moz-justify-content: center;
justify-content: center;
height: 137px;
text-align: center;
color: inherit;
}
.mag-block .item figcaption {
font-size: 16px;
line-height: 24px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
padding: 2px 10px 8px;
}
#media (max-width: 1219px) {
.mag-block .item figcaption {
font-size: 14px;
}
}
#media (max-width: 991px) {
.mag-block .item figcaption {
font-size: 16px;
}
}
#media (max-width: 767px) {
.mag-block .item figcaption {
font-size: 14px;
}
}
.mag-block .item .logo {
height: 50px;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
-webkit-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
-moz-align-items: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
-moz-justify-content: center;
justify-content: center;
}
.mag-block .item .logo img {
display: inline-block;
vertical-align: top;
max-height: 100%;
max-width: 100%;
}
.mag-block .item .logo .text {
display: block;
font-size: 30px;
line-height: 34px;
font-weight: 500;
padding: 14px 0 0;
}
.mag-block .item .more-link {
width: 142px;
margin-left: auto;
margin-right: auto;
font-size: 14px;
line-height: 20px;
font-weight: 500;
height: 0;
overflow: hidden;
-webkit-transition: all ease 0.3s;
-o-transition: all ease 0.3s;
transition: all ease 0.3s;
margin-top: -5px;
}
.mag-block .item .more-link span {
display: block;
padding: 7px 0 3px;
border-top: 2px solid lightgray;
}
.mag-block .item .more-link span:before {
content: '+ ';
color: #c2002d;
display: inline-block;
vertical-align: top;
margin-left: -20px;
padding-right: 4px;
}
.mag-block .item:hover {
margin: -11px -8px;
height: 200px;
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1);
}
.mag-block .item:hover .more-link {
height: 50px;
}
.stick-to-me {
position: relative;
padding-bottom: 50px;
z-index: 500;
}
.sticker {
position: absolute;
bottom: 0;
height: 50px;
z-index: -500;
background-color: #eee;
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<div class="container">
<div class="mag-block">
<div class="row flex-row">
<div class="col-md-3 col-sm-6 stick-to-me">
<a href="#" class="item">
<figure>
<div class="logo">
<strong class="text">Partner 1</strong>
</div>
<figcaption>small text about Partner 1 </figcaption>
</figure>
<footer class="more-link">
<span>Open</span>
</footer>
</a>
<div class="sticker">
<p> Sticker </p>
</div>
</div>
<!-- stick to me ends -->
<div class="col-md-3 col-sm-6 stick-to-me">
<a href="#" class="item">
<figure>
<div class="logo">
<strong class="text">Partner 2</strong>
</div>
<figcaption> tagline Partner 2</figcaption>
</figure>
<footer class="more-link">
<span>Open</span>
</footer>
</a>
<div class="sticker">
<p> Sticker </p>
</div>
</div>
<!-- stick to me ends -->
<div class="col-md-3 col-sm-6 stick-to-me">
<a href="#" class="item">
<figure>
<div class="logo">
<strong class="text">Partner 3</strong>
</div>
<figcaption>tagline Partner 3</figcaption>
</figure>
<footer class="more-link">
<span>Open</span>
</footer>
</a>
<div class="sticker">
<p> Sticker </p>
</div>
</div>
<!-- stick to me ends -->
<div class="col-md-3 col-sm-6 stick-to-me">
<a href="#" class="item">
<figure>
<div class="logo">
<strong class="text">Partner 4</strong>
</div>
<figcaption>tagline Partner 4</figcaption>
</figure>
<footer class="more-link">
<span>Open</span>
</footer>
</a>
<div class="sticker">
<p> Sticker </p>
</div>
</div>
<!-- stick to me ends -->
</div>
</div>
<!-- mag-block -->
I looked briefly at your code, my suggestion is just to add this lin in your css. I edited in your fiddle and it works. I believe it is close to what you need.
I can add more detail to this answer after work if you need.
.stick-to-me:hover{
padding-bottom: 0px;
}
You should try this
.stick-to-me { padding-bottom:0px; min-height:137px; }
.stick-to-me .item { width:100%; height:100%; min-height:137px; position:absolute; top:0px; left:0px; }
.sticker { bottom:-50px; }
It will work for you.

Aligning Flexbox sections when resizing browser

Above is a screenshot of how it looks on a 1920 width browser. This is essentially the layout I want, but when I resize the browser, it looks like this:
I would like the boxes to have no white spacing to the left and right of the individual sections and keep them all the same 100% width with/without the spacing.
I realize the spacing is occuring because of how the code is set up where the middle section has margin that pushes it away, but I'm not sure how to set this up to achieve both the first screenshot and this effect.
Fiddle: https://jsfiddle.net/jzhang172/r641pmzb/
body,
html {
margin: 0px;
font-family: lato-reg;
font-size: 16px;
color: #3c3c3c;
overflow-x: hidden;
}
img {
width: 100%;
height: 100%;
}
.section {
position: relative;
}
/*--------------------------------------Fifth Section--*/
.flex-container {
margin-top: 10px;
width: 100%;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-flex-flow: row wrap;
-ms-flex-flow: row wrap;
flex-flow: row wrap;
}
.work-indiv {
width: 540px;
-webkit-flex: auto;
-ms-flex: auto;
flex: auto;
display: inline-block;
height: 237px;
position: relative;
margin-bottom: 10px;
cursor: pointer;
transition: 1s;
}
.work-indiv:hover img {
opacity: .6;
transition: .6s;
}
.middle {
padding-left: 10px;
padding-right: 10px;
width: 783px;
}
.work-indiv span {
position: absolute;
clear: both;
bottom: 0;
left: 0;
color: White;
margin-left: 40px;
text-transform: uppercase;
margin-bottom: 40px;
font-size: 2.125em;
font-family: latobold;
letter-spacing: .16em;
}
.middle span {
margin-left: 50px;
}
<div class="section" id="fifth">
<div class="flex-container">
<div class="work-indiv">
<img src="https://pixabay.com/static/uploads/photo/2015/12/21/06/41/landscape-1102117_960_720.jpg" alt="Topworkz">
<span>Topworkz</span>
</div>
<div class="work-indiv middle">
<img src="https://pixabay.com/static/uploads/photo/2015/12/21/06/41/landscape-1102117_960_720.jpg" alt="Joint">
<span>Joint</span>
</div>
<div class="work-indiv">
<img src="https://pixabay.com/static/uploads/photo/2015/12/21/06/41/landscape-1102117_960_720.jpg" alt="Market">
<span>Market</span>
</div>
<div class="work-indiv">
<img src="https://pixabay.com/static/uploads/photo/2015/12/21/06/41/landscape-1102117_960_720.jpg" alt="Worktop">
<span>Worktop</span>
</div>
<div class="work-indiv middle">
<img src="https://pixabay.com/static/uploads/photo/2015/12/21/06/41/landscape-1102117_960_720.jpg" alt="Lable">
<span>Lable</span>
</div>
<div class="work-indiv">
<img src="https://pixabay.com/static/uploads/photo/2015/12/21/06/41/landscape-1102117_960_720.jpg" alt="KYIV">
<span>KYIV</span>
</div>
</div>
Try removing the left and right padding on .middle in a media query for smaller screen sizes.
You have this in your code:
.middle {
padding-left: 10px;
padding-right: 10px;
width: 783px;
}
Try this adjustment:
#media screen and ( max-width: 1200px) {
.middle {
padding-left: 0;
padding-right: 0; }
}
Now, when the screen size is less than 1200px wide, the padding is removed.
Revised Demo
Change the padding of the elements to be always 5px.
Now, the separation between them is 10px, that is what you want.
To make the padding on the left most elements appear to be zero again, set a negative margin of -5px on the flex container. This will make the illusion that the elements are alligned perfectly
body,
html {
margin: 0px;
font-family: lato-reg;
font-size: 16px;
color: #3c3c3c;
overflow-x: hidden;
}
img {
width: 100%;
height: 100%;
}
.section {
position: relative;
}
/*--------------------------------------Fifth Section--*/
.flex-container {
margin-top: 10px;
width: 100%;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-flex-flow: row wrap;
-ms-flex-flow: row wrap;
flex-flow: row wrap;
margin-left: -5px;
margin-right: -5px;
}
.work-indiv {
width: 540px;
-webkit-flex: auto;
-ms-flex: auto;
flex: auto;
display: inline-block;
height: 237px;
position: relative;
margin-bottom: 10px;
cursor: pointer;
transition: 1s;
padding-left: 5px;
padding-right: 5px;
}
.work-indiv:hover img {
opacity: .6;
transition: .6s;
}
.middle {
width: 783px;
}
.work-indiv span {
position: absolute;
clear: both;
bottom: 0;
left: 0;
color: White;
margin-left: 40px;
text-transform: uppercase;
margin-bottom: 40px;
font-size: 2.125em;
font-family: latobold;
letter-spacing: .16em;
}
.middle span {
margin-left: 50px;
}
<div class="section" id="fifth">
<div class="flex-container">
<div class="work-indiv">
<img src="https://pixabay.com/static/uploads/photo/2015/12/21/06/41/landscape-1102117_960_720.jpg" alt="Topworkz">
<span>Topworkz</span>
</div>
<div class="work-indiv middle">
<img src="https://pixabay.com/static/uploads/photo/2015/12/21/06/41/landscape-1102117_960_720.jpg" alt="Joint">
<span>Joint</span>
</div>
<div class="work-indiv">
<img src="https://pixabay.com/static/uploads/photo/2015/12/21/06/41/landscape-1102117_960_720.jpg" alt="Market">
<span>Market</span>
</div>
<div class="work-indiv">
<img src="https://pixabay.com/static/uploads/photo/2015/12/21/06/41/landscape-1102117_960_720.jpg" alt="Worktop">
<span>Worktop</span>
</div>
<div class="work-indiv middle">
<img src="https://pixabay.com/static/uploads/photo/2015/12/21/06/41/landscape-1102117_960_720.jpg" alt="Lable">
<span>Lable</span>
</div>
<div class="work-indiv">
<img src="https://pixabay.com/static/uploads/photo/2015/12/21/06/41/landscape-1102117_960_720.jpg" alt="KYIV">
<span>KYIV</span>
</div>
</div>