Best way to make a 2 column layout that works with multiple resolutions?











up vote
0
down vote

favorite












I've asked this a couple times but seems like I didn't word it quite right so will try do better here,



I'm trying to make a 2 column layout in HTML, CSS, & Java, what I want is the text on the left to center in the middle of both columns once the resolution is too low (by this I mean the columns look great in 1920x width and 1600x width, but when it gets down to 1200x800 the text breaks past the height of the right image).



I've seen a website that once the page width hits a certain point (around 1200x width) the text in the left column snaps to center in the middle of both, which results in the page looking good at all res. I have a feeling the text is overlayed on top of both columns with a java snippet that tells the text to move into the center at a certain width, only problem is I don't know how to achieve that,



I've attached my code at the bottom but in my version the text is inside the left column, am I right thinking that the text is probably on-top of both columns? and is there a javascript to tell the text to move center at a certain width? would really appreciate any help!



HTML:



<div class="content1">
<div class="column1 animation fadeInUp">
<div class="title1">
<h3>STATEMENT</h3> .
<h2>Title of Some Sort.</h2>
<div class="blue-line"></div>
</div>
<p1>Paragraph text.<br></p1>
<button class="svg1">FORUM</button>
<button class="svg2">SIGN UP</button>
</div>
<div class="column2">
<div class="column2pic"></div>
</div>
</div>


CSS:



.content1 {
display: flex;
margin-left:100px;
margin-right:0px;
}

.column1 {
display:inline-block;
flex: 31%;
padding-bottom: 0px;
padding-right:50px;
opacity: 0; animation-play-state: paused;
}

.animated {
-webkit-animation-duration: 1.5s;
animation-duration: 1.5s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
animation-play-state: running;
}

.fadeInUp {
-webkit-animation-name: fadeInUp;
animation-name: fadeInUp;
}


@keyframes fadeInUp {
from {
opacity: 0;
-webkit-transform: translate3d(0, 2.5rem, 0);
transform: translate3d(0, 2.5rem, 0);
}

to {
opacity: 1;
-webkit-transform: none;
transform: none;
}

.column2 {
flex: 50%;
padding-bottom: 0px;
padding-left:100px;
padding-top:0px;
width:50vw;
}

.column2pic {
background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0,
0.0)), url(../Assets/Images/Content1pic);
background-size:cover;
z-index: 100;
width:50vw;
height:600px;
}


NOTE: the animation is just a simple effect for the left text to fade up, but don't mind if anyone excludes that part to keep it simple.



Let me know if you have any ideas! Thanks!










share|improve this question







New contributor




JTR is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    One thing that would make things easy in terms of responsiveness would be using flexbox, or existing CSS frameworks, such as Bootstrap. Both are responsive in design. I would suggest having a look at either of those. Alternatively, you could use media queries, if you prefer to build it yourself entirely. But then again, why reinvent the wheel? ;)
    – Martin
    Nov 8 at 9:29










  • Here's a wordpress template that's doing exactly what I'd like my 2 column layout to do, from looking at this and pulling in the right side of the browser window you can see it snaps the text to center, is one of those frameworks how you think they are achieving it? templatemonster.com/demo/53878.html (they've given it a class "elementor")
    – JTR
    Nov 8 at 9:37










  • Bootstrap has the exact same functionality within its framework. All you need to do is look up the classes for it, e.g. row, col, col-sm-, col-md-, col-lg- etc. More here: getbootstrap.com/docs/4.0/layout/grid
    – Martin
    Nov 8 at 9:42















up vote
0
down vote

favorite












I've asked this a couple times but seems like I didn't word it quite right so will try do better here,



I'm trying to make a 2 column layout in HTML, CSS, & Java, what I want is the text on the left to center in the middle of both columns once the resolution is too low (by this I mean the columns look great in 1920x width and 1600x width, but when it gets down to 1200x800 the text breaks past the height of the right image).



I've seen a website that once the page width hits a certain point (around 1200x width) the text in the left column snaps to center in the middle of both, which results in the page looking good at all res. I have a feeling the text is overlayed on top of both columns with a java snippet that tells the text to move into the center at a certain width, only problem is I don't know how to achieve that,



I've attached my code at the bottom but in my version the text is inside the left column, am I right thinking that the text is probably on-top of both columns? and is there a javascript to tell the text to move center at a certain width? would really appreciate any help!



HTML:



<div class="content1">
<div class="column1 animation fadeInUp">
<div class="title1">
<h3>STATEMENT</h3> .
<h2>Title of Some Sort.</h2>
<div class="blue-line"></div>
</div>
<p1>Paragraph text.<br></p1>
<button class="svg1">FORUM</button>
<button class="svg2">SIGN UP</button>
</div>
<div class="column2">
<div class="column2pic"></div>
</div>
</div>


CSS:



.content1 {
display: flex;
margin-left:100px;
margin-right:0px;
}

.column1 {
display:inline-block;
flex: 31%;
padding-bottom: 0px;
padding-right:50px;
opacity: 0; animation-play-state: paused;
}

.animated {
-webkit-animation-duration: 1.5s;
animation-duration: 1.5s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
animation-play-state: running;
}

.fadeInUp {
-webkit-animation-name: fadeInUp;
animation-name: fadeInUp;
}


@keyframes fadeInUp {
from {
opacity: 0;
-webkit-transform: translate3d(0, 2.5rem, 0);
transform: translate3d(0, 2.5rem, 0);
}

to {
opacity: 1;
-webkit-transform: none;
transform: none;
}

.column2 {
flex: 50%;
padding-bottom: 0px;
padding-left:100px;
padding-top:0px;
width:50vw;
}

.column2pic {
background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0,
0.0)), url(../Assets/Images/Content1pic);
background-size:cover;
z-index: 100;
width:50vw;
height:600px;
}


NOTE: the animation is just a simple effect for the left text to fade up, but don't mind if anyone excludes that part to keep it simple.



Let me know if you have any ideas! Thanks!










share|improve this question







New contributor




JTR is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 1




    One thing that would make things easy in terms of responsiveness would be using flexbox, or existing CSS frameworks, such as Bootstrap. Both are responsive in design. I would suggest having a look at either of those. Alternatively, you could use media queries, if you prefer to build it yourself entirely. But then again, why reinvent the wheel? ;)
    – Martin
    Nov 8 at 9:29










  • Here's a wordpress template that's doing exactly what I'd like my 2 column layout to do, from looking at this and pulling in the right side of the browser window you can see it snaps the text to center, is one of those frameworks how you think they are achieving it? templatemonster.com/demo/53878.html (they've given it a class "elementor")
    – JTR
    Nov 8 at 9:37










  • Bootstrap has the exact same functionality within its framework. All you need to do is look up the classes for it, e.g. row, col, col-sm-, col-md-, col-lg- etc. More here: getbootstrap.com/docs/4.0/layout/grid
    – Martin
    Nov 8 at 9:42













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I've asked this a couple times but seems like I didn't word it quite right so will try do better here,



I'm trying to make a 2 column layout in HTML, CSS, & Java, what I want is the text on the left to center in the middle of both columns once the resolution is too low (by this I mean the columns look great in 1920x width and 1600x width, but when it gets down to 1200x800 the text breaks past the height of the right image).



I've seen a website that once the page width hits a certain point (around 1200x width) the text in the left column snaps to center in the middle of both, which results in the page looking good at all res. I have a feeling the text is overlayed on top of both columns with a java snippet that tells the text to move into the center at a certain width, only problem is I don't know how to achieve that,



I've attached my code at the bottom but in my version the text is inside the left column, am I right thinking that the text is probably on-top of both columns? and is there a javascript to tell the text to move center at a certain width? would really appreciate any help!



HTML:



<div class="content1">
<div class="column1 animation fadeInUp">
<div class="title1">
<h3>STATEMENT</h3> .
<h2>Title of Some Sort.</h2>
<div class="blue-line"></div>
</div>
<p1>Paragraph text.<br></p1>
<button class="svg1">FORUM</button>
<button class="svg2">SIGN UP</button>
</div>
<div class="column2">
<div class="column2pic"></div>
</div>
</div>


CSS:



.content1 {
display: flex;
margin-left:100px;
margin-right:0px;
}

.column1 {
display:inline-block;
flex: 31%;
padding-bottom: 0px;
padding-right:50px;
opacity: 0; animation-play-state: paused;
}

.animated {
-webkit-animation-duration: 1.5s;
animation-duration: 1.5s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
animation-play-state: running;
}

.fadeInUp {
-webkit-animation-name: fadeInUp;
animation-name: fadeInUp;
}


@keyframes fadeInUp {
from {
opacity: 0;
-webkit-transform: translate3d(0, 2.5rem, 0);
transform: translate3d(0, 2.5rem, 0);
}

to {
opacity: 1;
-webkit-transform: none;
transform: none;
}

.column2 {
flex: 50%;
padding-bottom: 0px;
padding-left:100px;
padding-top:0px;
width:50vw;
}

.column2pic {
background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0,
0.0)), url(../Assets/Images/Content1pic);
background-size:cover;
z-index: 100;
width:50vw;
height:600px;
}


NOTE: the animation is just a simple effect for the left text to fade up, but don't mind if anyone excludes that part to keep it simple.



Let me know if you have any ideas! Thanks!










share|improve this question







New contributor




JTR is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I've asked this a couple times but seems like I didn't word it quite right so will try do better here,



I'm trying to make a 2 column layout in HTML, CSS, & Java, what I want is the text on the left to center in the middle of both columns once the resolution is too low (by this I mean the columns look great in 1920x width and 1600x width, but when it gets down to 1200x800 the text breaks past the height of the right image).



I've seen a website that once the page width hits a certain point (around 1200x width) the text in the left column snaps to center in the middle of both, which results in the page looking good at all res. I have a feeling the text is overlayed on top of both columns with a java snippet that tells the text to move into the center at a certain width, only problem is I don't know how to achieve that,



I've attached my code at the bottom but in my version the text is inside the left column, am I right thinking that the text is probably on-top of both columns? and is there a javascript to tell the text to move center at a certain width? would really appreciate any help!



HTML:



<div class="content1">
<div class="column1 animation fadeInUp">
<div class="title1">
<h3>STATEMENT</h3> .
<h2>Title of Some Sort.</h2>
<div class="blue-line"></div>
</div>
<p1>Paragraph text.<br></p1>
<button class="svg1">FORUM</button>
<button class="svg2">SIGN UP</button>
</div>
<div class="column2">
<div class="column2pic"></div>
</div>
</div>


CSS:



.content1 {
display: flex;
margin-left:100px;
margin-right:0px;
}

.column1 {
display:inline-block;
flex: 31%;
padding-bottom: 0px;
padding-right:50px;
opacity: 0; animation-play-state: paused;
}

.animated {
-webkit-animation-duration: 1.5s;
animation-duration: 1.5s;
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
animation-play-state: running;
}

.fadeInUp {
-webkit-animation-name: fadeInUp;
animation-name: fadeInUp;
}


@keyframes fadeInUp {
from {
opacity: 0;
-webkit-transform: translate3d(0, 2.5rem, 0);
transform: translate3d(0, 2.5rem, 0);
}

to {
opacity: 1;
-webkit-transform: none;
transform: none;
}

.column2 {
flex: 50%;
padding-bottom: 0px;
padding-left:100px;
padding-top:0px;
width:50vw;
}

.column2pic {
background-image: linear-gradient(rgba(0, 0, 0, 0.3), rgba(0, 0, 0,
0.0)), url(../Assets/Images/Content1pic);
background-size:cover;
z-index: 100;
width:50vw;
height:600px;
}


NOTE: the animation is just a simple effect for the left text to fade up, but don't mind if anyone excludes that part to keep it simple.



Let me know if you have any ideas! Thanks!







javascript html css






share|improve this question







New contributor




JTR is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




JTR is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




JTR is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 8 at 9:25









JTR

54




54




New contributor




JTR is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





JTR is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






JTR is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 1




    One thing that would make things easy in terms of responsiveness would be using flexbox, or existing CSS frameworks, such as Bootstrap. Both are responsive in design. I would suggest having a look at either of those. Alternatively, you could use media queries, if you prefer to build it yourself entirely. But then again, why reinvent the wheel? ;)
    – Martin
    Nov 8 at 9:29










  • Here's a wordpress template that's doing exactly what I'd like my 2 column layout to do, from looking at this and pulling in the right side of the browser window you can see it snaps the text to center, is one of those frameworks how you think they are achieving it? templatemonster.com/demo/53878.html (they've given it a class "elementor")
    – JTR
    Nov 8 at 9:37










  • Bootstrap has the exact same functionality within its framework. All you need to do is look up the classes for it, e.g. row, col, col-sm-, col-md-, col-lg- etc. More here: getbootstrap.com/docs/4.0/layout/grid
    – Martin
    Nov 8 at 9:42














  • 1




    One thing that would make things easy in terms of responsiveness would be using flexbox, or existing CSS frameworks, such as Bootstrap. Both are responsive in design. I would suggest having a look at either of those. Alternatively, you could use media queries, if you prefer to build it yourself entirely. But then again, why reinvent the wheel? ;)
    – Martin
    Nov 8 at 9:29










  • Here's a wordpress template that's doing exactly what I'd like my 2 column layout to do, from looking at this and pulling in the right side of the browser window you can see it snaps the text to center, is one of those frameworks how you think they are achieving it? templatemonster.com/demo/53878.html (they've given it a class "elementor")
    – JTR
    Nov 8 at 9:37










  • Bootstrap has the exact same functionality within its framework. All you need to do is look up the classes for it, e.g. row, col, col-sm-, col-md-, col-lg- etc. More here: getbootstrap.com/docs/4.0/layout/grid
    – Martin
    Nov 8 at 9:42








1




1




One thing that would make things easy in terms of responsiveness would be using flexbox, or existing CSS frameworks, such as Bootstrap. Both are responsive in design. I would suggest having a look at either of those. Alternatively, you could use media queries, if you prefer to build it yourself entirely. But then again, why reinvent the wheel? ;)
– Martin
Nov 8 at 9:29




One thing that would make things easy in terms of responsiveness would be using flexbox, or existing CSS frameworks, such as Bootstrap. Both are responsive in design. I would suggest having a look at either of those. Alternatively, you could use media queries, if you prefer to build it yourself entirely. But then again, why reinvent the wheel? ;)
– Martin
Nov 8 at 9:29












Here's a wordpress template that's doing exactly what I'd like my 2 column layout to do, from looking at this and pulling in the right side of the browser window you can see it snaps the text to center, is one of those frameworks how you think they are achieving it? templatemonster.com/demo/53878.html (they've given it a class "elementor")
– JTR
Nov 8 at 9:37




Here's a wordpress template that's doing exactly what I'd like my 2 column layout to do, from looking at this and pulling in the right side of the browser window you can see it snaps the text to center, is one of those frameworks how you think they are achieving it? templatemonster.com/demo/53878.html (they've given it a class "elementor")
– JTR
Nov 8 at 9:37












Bootstrap has the exact same functionality within its framework. All you need to do is look up the classes for it, e.g. row, col, col-sm-, col-md-, col-lg- etc. More here: getbootstrap.com/docs/4.0/layout/grid
– Martin
Nov 8 at 9:42




Bootstrap has the exact same functionality within its framework. All you need to do is look up the classes for it, e.g. row, col, col-sm-, col-md-, col-lg- etc. More here: getbootstrap.com/docs/4.0/layout/grid
– Martin
Nov 8 at 9:42












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










You will need to use css @media. In your case, you will have to create @media only screen and (max-width: 1200px) with the style that you would like at this size. See below an example of it. I put the width to 400px to fit with this snippet. When you resize the browser window under 400px @media only screen and (max-width: 400px), it lowers the text size font-size: 20px; and align it in the center text-align: center;.






#mypic {
width: 100%;
max-width: 560px;
height: 350px;
background-image: url("https://images.pexels.com/photos/531880/pexels-photo-531880.jpeg?auto=compress&cs=tinysrgb&h=350");
font-size: 50px;
}

@media only screen and (max-width: 400px) {
#mypic {
font-size: 20px;
text-align: center;
}
}

<div id="mypic">My Title In Picture!</div>








share|improve this answer























  • So for this website, templatemonster.com/demo/53878.html is that what they are doing? its the "elementor" div in their site code. I'm not wanting to stop the screen getting smaller I'm wanting the 2 column layout to look good at separate resolutions, achieving it by moving the text from the left column to the middle of both columns once the resolution gets so low that the text tries to break out of its left container, resulting in way more space for the text at low resolution, like they do on the site like I've attached.
    – JTR
    Nov 8 at 9:48










  • Yes this is it. You will need to use @media. If you run the snippet, you will see the text get align in the middle as soon it is getting smaller than 400px;
    – Jonathan Gagne
    Nov 8 at 9:51










  • I made another example with the same text that you were talking about on the other website.
    – Jonathan Gagne
    Nov 8 at 9:59












  • You're an absolute legend.
    – JTR
    Nov 8 at 10:02










  • Hehe it was my pleasure! Enjoy!
    – Jonathan Gagne
    Nov 8 at 10:03











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






JTR is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53204775%2fbest-way-to-make-a-2-column-layout-that-works-with-multiple-resolutions%23new-answer', 'question_page');
}
);

Post as a guest
































1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










You will need to use css @media. In your case, you will have to create @media only screen and (max-width: 1200px) with the style that you would like at this size. See below an example of it. I put the width to 400px to fit with this snippet. When you resize the browser window under 400px @media only screen and (max-width: 400px), it lowers the text size font-size: 20px; and align it in the center text-align: center;.






#mypic {
width: 100%;
max-width: 560px;
height: 350px;
background-image: url("https://images.pexels.com/photos/531880/pexels-photo-531880.jpeg?auto=compress&cs=tinysrgb&h=350");
font-size: 50px;
}

@media only screen and (max-width: 400px) {
#mypic {
font-size: 20px;
text-align: center;
}
}

<div id="mypic">My Title In Picture!</div>








share|improve this answer























  • So for this website, templatemonster.com/demo/53878.html is that what they are doing? its the "elementor" div in their site code. I'm not wanting to stop the screen getting smaller I'm wanting the 2 column layout to look good at separate resolutions, achieving it by moving the text from the left column to the middle of both columns once the resolution gets so low that the text tries to break out of its left container, resulting in way more space for the text at low resolution, like they do on the site like I've attached.
    – JTR
    Nov 8 at 9:48










  • Yes this is it. You will need to use @media. If you run the snippet, you will see the text get align in the middle as soon it is getting smaller than 400px;
    – Jonathan Gagne
    Nov 8 at 9:51










  • I made another example with the same text that you were talking about on the other website.
    – Jonathan Gagne
    Nov 8 at 9:59












  • You're an absolute legend.
    – JTR
    Nov 8 at 10:02










  • Hehe it was my pleasure! Enjoy!
    – Jonathan Gagne
    Nov 8 at 10:03















up vote
1
down vote



accepted










You will need to use css @media. In your case, you will have to create @media only screen and (max-width: 1200px) with the style that you would like at this size. See below an example of it. I put the width to 400px to fit with this snippet. When you resize the browser window under 400px @media only screen and (max-width: 400px), it lowers the text size font-size: 20px; and align it in the center text-align: center;.






#mypic {
width: 100%;
max-width: 560px;
height: 350px;
background-image: url("https://images.pexels.com/photos/531880/pexels-photo-531880.jpeg?auto=compress&cs=tinysrgb&h=350");
font-size: 50px;
}

@media only screen and (max-width: 400px) {
#mypic {
font-size: 20px;
text-align: center;
}
}

<div id="mypic">My Title In Picture!</div>








share|improve this answer























  • So for this website, templatemonster.com/demo/53878.html is that what they are doing? its the "elementor" div in their site code. I'm not wanting to stop the screen getting smaller I'm wanting the 2 column layout to look good at separate resolutions, achieving it by moving the text from the left column to the middle of both columns once the resolution gets so low that the text tries to break out of its left container, resulting in way more space for the text at low resolution, like they do on the site like I've attached.
    – JTR
    Nov 8 at 9:48










  • Yes this is it. You will need to use @media. If you run the snippet, you will see the text get align in the middle as soon it is getting smaller than 400px;
    – Jonathan Gagne
    Nov 8 at 9:51










  • I made another example with the same text that you were talking about on the other website.
    – Jonathan Gagne
    Nov 8 at 9:59












  • You're an absolute legend.
    – JTR
    Nov 8 at 10:02










  • Hehe it was my pleasure! Enjoy!
    – Jonathan Gagne
    Nov 8 at 10:03













up vote
1
down vote



accepted







up vote
1
down vote



accepted






You will need to use css @media. In your case, you will have to create @media only screen and (max-width: 1200px) with the style that you would like at this size. See below an example of it. I put the width to 400px to fit with this snippet. When you resize the browser window under 400px @media only screen and (max-width: 400px), it lowers the text size font-size: 20px; and align it in the center text-align: center;.






#mypic {
width: 100%;
max-width: 560px;
height: 350px;
background-image: url("https://images.pexels.com/photos/531880/pexels-photo-531880.jpeg?auto=compress&cs=tinysrgb&h=350");
font-size: 50px;
}

@media only screen and (max-width: 400px) {
#mypic {
font-size: 20px;
text-align: center;
}
}

<div id="mypic">My Title In Picture!</div>








share|improve this answer














You will need to use css @media. In your case, you will have to create @media only screen and (max-width: 1200px) with the style that you would like at this size. See below an example of it. I put the width to 400px to fit with this snippet. When you resize the browser window under 400px @media only screen and (max-width: 400px), it lowers the text size font-size: 20px; and align it in the center text-align: center;.






#mypic {
width: 100%;
max-width: 560px;
height: 350px;
background-image: url("https://images.pexels.com/photos/531880/pexels-photo-531880.jpeg?auto=compress&cs=tinysrgb&h=350");
font-size: 50px;
}

@media only screen and (max-width: 400px) {
#mypic {
font-size: 20px;
text-align: center;
}
}

<div id="mypic">My Title In Picture!</div>








#mypic {
width: 100%;
max-width: 560px;
height: 350px;
background-image: url("https://images.pexels.com/photos/531880/pexels-photo-531880.jpeg?auto=compress&cs=tinysrgb&h=350");
font-size: 50px;
}

@media only screen and (max-width: 400px) {
#mypic {
font-size: 20px;
text-align: center;
}
}

<div id="mypic">My Title In Picture!</div>





#mypic {
width: 100%;
max-width: 560px;
height: 350px;
background-image: url("https://images.pexels.com/photos/531880/pexels-photo-531880.jpeg?auto=compress&cs=tinysrgb&h=350");
font-size: 50px;
}

@media only screen and (max-width: 400px) {
#mypic {
font-size: 20px;
text-align: center;
}
}

<div id="mypic">My Title In Picture!</div>






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 9 at 2:22

























answered Nov 8 at 9:37









Jonathan Gagne

1,7981720




1,7981720












  • So for this website, templatemonster.com/demo/53878.html is that what they are doing? its the "elementor" div in their site code. I'm not wanting to stop the screen getting smaller I'm wanting the 2 column layout to look good at separate resolutions, achieving it by moving the text from the left column to the middle of both columns once the resolution gets so low that the text tries to break out of its left container, resulting in way more space for the text at low resolution, like they do on the site like I've attached.
    – JTR
    Nov 8 at 9:48










  • Yes this is it. You will need to use @media. If you run the snippet, you will see the text get align in the middle as soon it is getting smaller than 400px;
    – Jonathan Gagne
    Nov 8 at 9:51










  • I made another example with the same text that you were talking about on the other website.
    – Jonathan Gagne
    Nov 8 at 9:59












  • You're an absolute legend.
    – JTR
    Nov 8 at 10:02










  • Hehe it was my pleasure! Enjoy!
    – Jonathan Gagne
    Nov 8 at 10:03


















  • So for this website, templatemonster.com/demo/53878.html is that what they are doing? its the "elementor" div in their site code. I'm not wanting to stop the screen getting smaller I'm wanting the 2 column layout to look good at separate resolutions, achieving it by moving the text from the left column to the middle of both columns once the resolution gets so low that the text tries to break out of its left container, resulting in way more space for the text at low resolution, like they do on the site like I've attached.
    – JTR
    Nov 8 at 9:48










  • Yes this is it. You will need to use @media. If you run the snippet, you will see the text get align in the middle as soon it is getting smaller than 400px;
    – Jonathan Gagne
    Nov 8 at 9:51










  • I made another example with the same text that you were talking about on the other website.
    – Jonathan Gagne
    Nov 8 at 9:59












  • You're an absolute legend.
    – JTR
    Nov 8 at 10:02










  • Hehe it was my pleasure! Enjoy!
    – Jonathan Gagne
    Nov 8 at 10:03
















So for this website, templatemonster.com/demo/53878.html is that what they are doing? its the "elementor" div in their site code. I'm not wanting to stop the screen getting smaller I'm wanting the 2 column layout to look good at separate resolutions, achieving it by moving the text from the left column to the middle of both columns once the resolution gets so low that the text tries to break out of its left container, resulting in way more space for the text at low resolution, like they do on the site like I've attached.
– JTR
Nov 8 at 9:48




So for this website, templatemonster.com/demo/53878.html is that what they are doing? its the "elementor" div in their site code. I'm not wanting to stop the screen getting smaller I'm wanting the 2 column layout to look good at separate resolutions, achieving it by moving the text from the left column to the middle of both columns once the resolution gets so low that the text tries to break out of its left container, resulting in way more space for the text at low resolution, like they do on the site like I've attached.
– JTR
Nov 8 at 9:48












Yes this is it. You will need to use @media. If you run the snippet, you will see the text get align in the middle as soon it is getting smaller than 400px;
– Jonathan Gagne
Nov 8 at 9:51




Yes this is it. You will need to use @media. If you run the snippet, you will see the text get align in the middle as soon it is getting smaller than 400px;
– Jonathan Gagne
Nov 8 at 9:51












I made another example with the same text that you were talking about on the other website.
– Jonathan Gagne
Nov 8 at 9:59






I made another example with the same text that you were talking about on the other website.
– Jonathan Gagne
Nov 8 at 9:59














You're an absolute legend.
– JTR
Nov 8 at 10:02




You're an absolute legend.
– JTR
Nov 8 at 10:02












Hehe it was my pleasure! Enjoy!
– Jonathan Gagne
Nov 8 at 10:03




Hehe it was my pleasure! Enjoy!
– Jonathan Gagne
Nov 8 at 10:03










JTR is a new contributor. Be nice, and check out our Code of Conduct.










 

draft saved


draft discarded


















JTR is a new contributor. Be nice, and check out our Code of Conduct.













JTR is a new contributor. Be nice, and check out our Code of Conduct.












JTR is a new contributor. Be nice, and check out our Code of Conduct.















 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53204775%2fbest-way-to-make-a-2-column-layout-that-works-with-multiple-resolutions%23new-answer', 'question_page');
}
);

Post as a guest




















































































Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)