Having an issue getting my divs to fall next to each other. I've been scouring forums for a few hours, but with no success.
I'm trying to create a collage with six images. At the moment, all of my images are running down the left side, one after the other. It's probably important to note that I have set these 6 images as the background of six different divs, all housed within the "Collage" div.
I've tried applying float to one of these 6 relative divs, but it just disappears.
Normally I would have just set this all in pixels and moved everything around manually, but I am aiming for responsive layout.
How can I make the images appear beside each other responsively?
#collage-container {
max-width: 97%;
padding-right: 1%;
padding-left: 5%;
position: relative;
padding-bottom: 15%;
height: 0;
}
#collagecont2 {
position: relative;
max-width: 47%;
min-height: 70em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/PHALANTAFRONTPAGEAD.jpg?10407604049650997072');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont3 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/SANTACLAUSEFRONTPAGEAD.jpg?10527560584571387867');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont4 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/EXORBUTTERFRONTPAGEAD.jpg?10527560584571387867');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont5 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont6 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont1 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
background-size: 100% 100%;
background-repeat: no-repeat;
}
.large:hover {
color: #FF0000;
}
.large {
position: absolute;
color: #00FF00;
font-family: arial;
font-size: 20pt;
bottom: 1%;
}
}
<div id="collage-container">
<div id="collagecont1">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont2">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont3">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont4">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont5">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont6">
<div class="large">
This is a DIV sample.
</div>
</div>
</div>
Show different sized images side by side nicely
To display the images next to each other, use CSS columns and display:inline-block children. Use font-size: 0 on the parent and font-size: insert font size on the children to neutralize the white-space between elements.
#collage-container {
font-size: 0;
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
}
[id^="collagecont"] {
font-size: 20pt;
width: 100%;
display: inline-block;
vertical-align: top;
background-size: cover;
background-repeat: no-repeat;
position: relative;
}
Maintain div aspect ratio
Use the css padding trick to maintain the aspect ratio of the images. You have different sized images so the padding-bottom property on the parent will change for each size.
[id^="collagecont"] {
background-size: cover;
background-repeat: no-repeat;
}
#collagecont1 {
padding-bottom: 46.5%;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
}
#collagecont2 {
padding-bottom: 120%;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/PHALANTAFRONTPAGEAD.jpg?10407604049650997072');
}
#collagecont3 {
padding-bottom: 100%;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/SANTACLAUSEFRONTPAGEAD.jpg?10527560584571387867');
}
#collagecont4 {
padding-bottom: 100%;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/EXORBUTTERFRONTPAGEAD.jpg?10527560584571387867');
}
#collagecont5 {
padding-bottom: 46.5%;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
}
#collagecont6 {
padding-bottom: 46.5%;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
}
Other code simplifications of lesser importance in the demo below.
body {
margin: 0;
}
#collage-container {
padding: 5%;
box-sizing: border-box;
font-size: 0;
-webkit-column-count: 2;
-moz-column-count: 2;
column-count: 2;
}
[id^="collagecont"] {
font-size: 20pt;
width: 98%;
display: inline-block;
vertical-align: top;
background-size: cover;
background-repeat: no-repeat;
position: relative;
color: #00FF00;
font-family: arial;
margin: 1%;
}
[id^="collagecont"]:hover {
color: #FF0000;
}
.large {
position: absolute;
width: 100%;
height: 100%;
}
#collagecont1 {
padding-bottom: 46.5%;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
}
#collagecont2 {
padding-bottom: 120%;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/PHALANTAFRONTPAGEAD.jpg?10407604049650997072');
}
#collagecont3 {
padding-bottom: 100%;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/SANTACLAUSEFRONTPAGEAD.jpg?10527560584571387867');
}
#collagecont4 {
padding-bottom: 100%;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/EXORBUTTERFRONTPAGEAD.jpg?10527560584571387867');
}
#collagecont5 {
padding-bottom: 46.5%;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
}
#collagecont6 {
padding-bottom: 46.5%;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
}
<div id="collage-container">
<div id="collagecont1">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont2">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont3">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont4">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont5">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont6">
<div class="large">
This is a DIV sample.
</div>
</div>
</div>
With absolute positioning everything becomes posistioned relative to the parent. What the responsive css frameworks like bootstrap use are floating elements.
When you float something it shrink wraps to the size of the content unless you give it a width. So to float 6 items one next to the other they can't be wider than 16.66666667% (100%/6). Your large class would become:
.large {
float: left;
width: 16.6%;
}
The following fiddle demonstrates the effect:
https://jsfiddle.net/30j3046d/
The first problem is that you need to set your divs to be displayed as an inline-block. Then next problem is that you need to set a min-width on your divs. I was able to solve both issues using this:
div[id^=collagecont] {
display: inline-block;
min-width: 30%;
}
However, it would probably be better to add a class to your divs and put all of the like attributes together.
#collage-container {
max-width: 97%;
padding-right: 1%;
padding-left: 5%;
position: relative;
padding-bottom: 15%;
}
#collagecont2 {
position: relative;
max-width: 47%;
min-height: 70em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/PHALANTAFRONTPAGEAD.jpg?10407604049650997072');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont3 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/SANTACLAUSEFRONTPAGEAD.jpg?10527560584571387867');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont4 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/EXORBUTTERFRONTPAGEAD.jpg?10527560584571387867');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont5 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont6 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
background-size: 100% 100%;
background-repeat: no-repeat;
}
#collagecont1 {
position: relative;
max-width: 45%;
min-height: 20em;
background-image: url('https://cdn.shopify.com/s/files/1/0813/2907/files/935COLPAGECOV.jpg?10407604049650997072');
background-size: 100% 100%;
background-repeat: no-repeat;
}
div[id^=collagecont] {
display: inline-block;
min-width: 30%;
}
.large:hover {
color: #FF0000;
}
.large {
position: absolute;
color: #00FF00;
font-family: arial;
font-size: 20pt;
bottom: 1%;
}
<div id="collage-container">
<div id="collagecont1">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont2">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont3">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont4">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont5">
<div class="large">
This is a DIV sample.
</div>
</div>
<div id="collagecont6">
<div class="large">
This is a DIV sample.
</div>
</div>
</div>
add the following code to your css
#collagecont1.large, #collagecont2.large, #collagecont2.large, #collagecont4.large, #collagecont5.large, #collagecont6.large{display:inline-block;}
if you put your class next to your id and get rid of the inside div like this
<div id="collagecont1" class="large">
it'll probably be more what you're looking for
Output
Related
Good morning everyone
How can I place the different DIVs on top of each other?
I have a row that contains left and right DIVs.
In the right I have image and in the left text.
I also have a DIV that needs to be placed between the text and the background.
I've tried and gotten a few things, but I can't get the right DIV sticky-top in the right place.
I don't want to use Java but only CSS
.infosite-container {
margin: 0 auto;
width: 100%;
position: relative;
}
.infosite-container .row {
display: table;
}
.infosite-container [class*="col-"] {
float: none;
display: table-cell;
vertical-align: top;
}
.sticky-top {
height: 150px;
width: 150px;
position: absolute;
background: red;
top: 50%;
left: 50%;
z-index: 999;
transform: translate(-50%, -50%);
}
.infosite-left-content {
padding-top: 175px;
padding-bottom: 175px;
padding-left: 120px;
text-align: left;
background-image: url(../../images/img-01.jpg);
background-repeat: no-repeat;
background-size: cover;
background-position: center center;
min-height: 680px;
/* height: 680px; */
z-index: 99;
}
.infosite-right-content {
padding-top: 175px;
padding-bottom: 175px;
padding-right: 120px;
padding-left: 60px;
text-align: left;
background-color: #bebebe;
min-height: 680px;
/* height: 680px; */
position: relative;
z-index: 99;
}
.uptxt {
position: relative;
z-index: 9999;
}
<section class="infosite" id="infosite-section">
<div class="container-fluid infosite-container">
<div class="row">
<div class="col-md-6 infosite-left-content">
<div class="">
</div>
</div>
<div class="sticky-top">
<p>Sticky Top</p>
</div>
<div class="col-md-6 infosite-right-content">
<div class="uptxt">
</div>
</div>
</div>
</div>
</section>
Can I get some help. I am sorry but I am not an expert.
Thanks
It's not working because you're parent is way larger than it's child. Because the div's could have different widths I suggest you to put the sticky-top div into the infosite-left-content class.
Like this:
<div class="container-fluid infosite-container">
<div class="row">
<div class="col-md-6 infosite-left-content">
<div class="sticky-top">
<p>Sticky Top</p>
</div>
</div>
<div class="col-md-6 infosite-right-content">
<div class="uptxt">
</div>
</div>
</div>
</div>
</section>
Second you need to adjust you css accordingly:
/* InfoSite ---------------------------------- */
.infosite-container {
margin: 0 auto;
width: 100%;
position:relative;
}
.infosite-container .row {
display: table;
}
.infosite-container [class*="col-"] {
float: none;
display: table-cell;
vertical-align: top;
}
.sticky-top {
height: 150px;
width: 150px;
position: absolute;
background:red;
top:50%;
right:-75px;
z-index:999;
transform: translateY(-50%)
}
.infosite-left-content {
position: relative;
background-color: blue;
padding-top: 175px;
padding-bottom: 175px;
padding-left: 120px;
text-align: left;
background-image: url(../../images/img-01.jpg);
background-repeat: no-repeat;
background-size: cover;
background-position: center center;
min-height: 680px;
/* height: 680px; */
z-index:100;
}
.infosite-right-content {
padding-top: 175px;
padding-bottom: 175px;
padding-right: 120px;
padding-left: 60px;
text-align: left;
background-color: #bebebe;
min-height: 680px;
/* height: 680px; */
position: relative;
z-index:99;
}
.uptxt {
position: relative;
z-index:9999;
}
/* ---------------------------------------------- */
I hope this works for you :D
Thank you for your response and possible solution.
Unfortunately it doesn't work as I would like, the sticky DIV stays on top of everything and not between the two divs.
I attach a picture of the result of how I would like its visualization.
Insert the sticky DIV between the background and the descriptive text that should appear as the last layer.
A possible solution is to use a single background DIV, ok it works, but I would like to have two of them so I can insert two images for example.
Thanks
Your css should be like this:
.infosite-container {
margin: 0 auto;
width: 100%;
position:relative;
}
.infosite-container .row {
display: table;
}
.infosite-container [class*="col-"] {
float: none;
display: table-cell;
vertical-align: top;
}
.sticky-top {
height: 150px;
width: 150px;
position: absolute;
background:red;
top:50%;
right:-75px;
z-index:500;
transform: translateY(-50%)
}
.infosite-left-content {
position: relative;
background-color: blue;
padding-top: 175px;
padding-bottom: 175px;
padding-left: 120px;
text-align: left;
background-image: url(../../images/img-01.jpg);
background-repeat: no-repeat;
background-size: cover;
background-position: center center;
min-height: 680px;
/* height: 680px; */
z-index:100;
}
.infosite-right-content {
padding-top: 175px;
padding-bottom: 175px;
padding-right: 120px;
padding-left: 60px;
text-align: left;
background-color: #bebebe;
min-height: 680px;
/* height: 680px; */
position: relative;
z-index:900;
}
.uptxt {
position: relative;
z-index:9999;
}
You can change the order in which the elements are stacked on top of each other with z-index - the greater it is, the higher the element will be !
I was wondering how to make an image overlap the container width it is placed in.
So, for example:
<div class="container">
<div class="background-image"></div>
</div>
And the CSS
.container {
max-width: 1170px;
}
.background-image {
background: url(/img/my-image.jpg) no-repeat center center;
}
So on a 1663px wide screen, the .container class is 1170px wide. The background image is 1170px wide as well.
What I'm trying to achieve, is make the image full-width (overlap the .container class so it's 1663px wide) without adjusting the HTML.
Thank you in advance.
For a fixed width of 1663px...
.container {
max-width: 1170px;
background: salmon;
padding: 50px 0;
margin: 0 auto;
}
.background-image {
background: url(https://www.fillmurray.com/800/300) no-repeat center center;
background-size: cover;
height: 300px;
/* The important part... */
width: 1663px;
max-width: 100vw;
position: relative;
left: 50%;
transform: translateX(-50%);
}
<div class="container">
<div class="background-image"></div>
</div>
(remove the max-width: 100vw; if you don't want the width to adjust with the window)
Or if you would rather full width...
.container {
max-width: 1170px;
background: salmon;
padding: 50px 0;
margin: 0 auto;
}
.background-image {
background: url(https://www.fillmurray.com/800/300) no-repeat center center;
background-size: cover;
height: 300px;
/* The important part... */
width: 100vw;
position: relative;
left: 50%;
transform: translateX(-50vw);
}
<div class="container">
<div class="background-image"></div>
</div>
If I understand your question correctly, You need to background image with full width.
.container {
max-width: 500px;
min-height: 500px;
background: blue;
margin: 0 auto;
color: red;
}
.background-image {
background: url(https://www.w3schools.com/cssref/paper.gif) repeat center center;
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
opacity: 0.6;
z-index: -1;
}
<div class="container">
<div class="background-image"></div>
container
</div>
If I understand your question correctly, you are looking for the property background-size: cover which will create the desired effect, i have added a code snippet so you can see.
.container {
max-width: 1170px;
}
.background-image {
background: url(/img/my-image.jpg) no-repeat center center;
background-size: cover;
/* This will create the effect you are looking for */
background-color: #000000;
/* This can be removed, for illustration purposes only*/
height: 500px;
/* This can be removed, for illustration purposes only*/
}
<div class="container">
<div class="background-image"></div>
</div>
I am trying to add a "strip" of an image to the left top of the div as a background with a fixed attachment property. Here it is:
https://jsfiddle.net/mvfariajr/recLr6yf/
HTML:
<div id="wrapper">
<div id="container">
<h1>TESTING</h1>
</div>
</div>
CSS:
#wrapper {
width: 100%;
height: 500px;
background-color: #ccc;
}
#container {
text-align: center;
margin: 0 auto;
width: 80%;
height: 400px;
background-color: #fff;
background-position: left top;
background-repeat: no-repeat;
background-size: 70px 100%;
background-attachment: fixed;
background-image: url(http://ariseartgroup.com/interiors/wp-content/uploads/2017/01/metal-texture-trim.jpg);
}
The issue is that the background isn't always to the left of the div.
Any help?
Thanks!
Here you go:
#wrapper {
width: 100%;
height: 500px;
background-color: #ccc;
}
#container {
text-align: center;
margin: 0 auto;
width: 80%;
height: 400px;
background:white url("http://ariseartgroup.com/interiors/wp-content/uploads/2017/01/metal-texture-trim.jpg") 10% 50% no-repeat;
background-size: 70px 100%;
background-attachment: fixed;
}
<div id="wrapper">
<div id="container">
<h1>TESTING</h1>
</div>
</div>
I was wondering how to center 3 divs inside a div.
Here is my code example
body {
position: fixed;
height: 100%;
width: 100%;
}
#container {
border: 3px solid black;
height: 90%;
width: 90%;
}
.plaatje {
width: 30%;
height: 70%;
border: 2px solid black;
float: left;
text-align: center;
}
#plaatje1 {
background-image: url("http://image.prntscr.com/image/c3d5dbc04f664a3386b372d8e4ceb4c7.png");
background-size: 100% 100%;
background-repeat: no-repeat;
}
#plaatje2 {
background-image: url("http://image.prntscr.com/image/2bcfd124f98a448cbae822337818ff4e.png");
background-size: 100% 100%;
background-repeat: no-repeat;
}
#plaatje3 {
background-image: url("http://image.prntscr.com/image/e1b7059d626f47cb94535bbba9887cc1.png");
background-size: 100% 100%;
background-repeat: no-repeat;
}
<div id="container">
<div id="plaatje1" class="plaatje">
</div>
<div id="plaatje2" class="plaatje">
</div>
<div id="plaatje3" class="plaatje">
</div>
</div>
The problem is, there is still a white space on the right hand-side of the picture, I have marked it so you know what i'm talking about.
It also needs to scale, so if I resize the window, that the third image doesn't pops below the first or that the space exists when I resize it fully.
Any help is appreciated.
I have created a jsFiddle which demonstrates how you can do this using flexbox. It doesn't require floating the elements and gives you with exactly what you're looking for.
I have added a wrapper around the images (.images) and given it the flex properties required to align its contents, then removed the floats and a few other unnecessary things.
Here is the browser support for flexbox: caniuse:flexbox
body {
position: fixed;
height: 100%;
width: 100%;
}
#container {
border: 3px solid black;
height: 90%;
width: 90%;
}
.images {
height: 90%;
display: flex;
justify-content: center;
}
.plaatje {
width: 30%;
height: 70%;
border: 2px solid black;
background-size: 100% 100%;
background-repeat: no-repeat;
}
#plaatje1 {
background-image: url("http://image.prntscr.com/image/c3d5dbc04f664a3386b372d8e4ceb4c7.png");
}
#plaatje2 {
background-image: url("http://image.prntscr.com/image/2bcfd124f98a448cbae822337818ff4e.png");
}
#plaatje3 {
background-image: url("http://image.prntscr.com/image/e1b7059d626f47cb94535bbba9887cc1.png");
}
<div id="container">
<div class="images">
<div id="plaatje1" class="plaatje"></div>
<div id="plaatje2" class="plaatje"></div>
<div id="plaatje3" class="plaatje"></div>
</div>
</div>
You could just simply try adding text-align:center; to your container div
There are many ways to do this, and you should probably start with http://www.w3schools.com/css/css_align.asp - this elementary level question often gets flagged as not appropriate for SO.
But! Welcome. Here's one way you could do this - I've added comments to explain what's going on. Basically your float: left by definition made the .plaatjes impossible to center; and the text-align: center needs to be on the containing element
body {
position: fixed; /* probably don't actually want */
height: 100%;
width: 100%;
margin: 0; /* add */
}
#container {
border: 3px solid black;
height: 90%;
width: 90%;
margin-left: 5%;
text-align: center; /* add */
}
.plaatje {
width: 30%;
height: 70%;
border: 2px solid black;
/* float: left; // remove
text-align: center;*/
display: inline-block; /* add */
}
#plaatje1 {
background-image: url("http://image.prntscr.com/image/c3d5dbc04f664a3386b372d8e4ceb4c7.png");
background-size: 100% 100%;
background-repeat: no-repeat;
}
#plaatje2 {
background-image: url("http://image.prntscr.com/image/2bcfd124f98a448cbae822337818ff4e.png");
background-size: 100% 100%;
background-repeat: no-repeat;
}
#plaatje3 {
background-image: url("http://image.prntscr.com/image/e1b7059d626f47cb94535bbba9887cc1.png");
background-size: 100% 100%;
background-repeat: no-repeat;
}
<div id="container">
<div id="plaatje1" class="plaatje">
</div><div id="plaatje2" class="plaatje">
</div><div id="plaatje3" class="plaatje">
</div>
</div>
<!-- removed spaces between the divs -->
The text is already on top of the image, but the image changes in size when you resize the page. How can you let the text adjust it's center to the height of the image?
This is what I got
HTML
<section id="eyeCatcher">
<div id="catchContainer" >
<div id="eyeCatchQuote">
<h1>text</h1>
</div>
<span id="eyeCatchPhoto" role="img" >
<span class="inner">
</span>
</span>
</div>
</section>
CSS
#eyeCatcher{
max-width: 1366px;
margin: 0 auto;
}
#catchContainer {
max-width: 1366px;
}
#catchContainer #eyeCatchPhoto {
width: 100%;
display: inline-block;
vertical-align: middle;
font: 0/0 serif;
text-shadow: none;
color: transparent;
background-size: 100%;
background-position: 50% 50%;
background-repeat: no-repeat;
}
#catchContainer #eyeCatchPhoto .inner{
padding-top: 60%;
display: block;
height: 0;
}
#catchContainer #eyeCatchPhoto{
background-image: url("../img/overview.jpeg");
}
#eyeCatchQuote{
margin-top: -26px;
position: relative;
top: 300px;
}
And this is what it looks like
Big
Resize to small
Instead of using a span with a background image you can use an actual image.Then it is possible to center the text using absolute positioning.
HTML:
<section id="eyeCatcher">
<div id="catchContainer">
<div id="eyeCatchQuote">
<h1>TEXT ELEMENT</h1>
</div>
<img src="YOURIMage" id="eyeCatchPhoto" role="img">
</div>
</section>
CSS:
#eyeCatcher {
max-width: 1366px;
margin: 0 auto;
}
#catchContainer {
max-width: 1366px;
position: relative;
}
#catchContainer #eyeCatchPhoto {
width:100%;
}
#eyeCatchQuote {
position: absolute;
top: 50%;
left:50%;
margin:0;
transform:translateX(-50%)translateY(-50%);
}
Here is a fiddle