I'm trying to put a form on a div where I have an image:Form on the image
The problem is that I cannot float the form to the right side and also the form is under the other divs just as the image I've also attached here:
Form under other divs
.slider__size {
overflow: hidden;
height: 570px;
position: relative;
font-family: "DINNextLTProLight";
}
.slider__img__position {
justify-content:center;
align-items:center;
display: flex;
position: absolute;
}
.slider__consolidado__img__position {
justify-content:center;
align-items:right;
display: flex;
position: absolute;
}
.img-responsive, .thumbnail a>img, .thumbnail>img {
display: block;
height: auto;
margin: auto;
position: relative;
}
.title__box {
padding-top:200px;
position: absolute;
padding-left: 50px;
}
.h1__home span{
color: white;
font-size: 50px;
letter-spacing: 1px;
font-weight: bolder;
}
#media (min-width: 600px) and (max-width: 992px) {
.img-responsive, .thumbnail a>img, .thumbnail>img {
max-width: 150%;
height: auto;
position: relative;
margin: auto;
}
}
#media (min-width: 400px) and (max-width: 600px) {
.img-responsive, .thumbnail a>img, .thumbnail>img {
max-width: 250%;
}
}
#media (max-width: 400px) {
.img-responsive, .thumbnail a>img, .thumbnail>img {
max-width: 300%;
height: auto;
position: relative;
margin: auto;
}
#media (max-width: 300px) {
.img-responsive, .thumbnail a>img, .thumbnail>img {
max-width: 400%;
}
}
}
#media (min-width: 768px) {
.navbar-fixed-bottom { display: none;}
}
#media (min-width:768px){
.form__consolidado__color {
margin-top: 120px;
position: absolute;
margin-left: 20px;
box-shadow: 0 0 6px 0px black;
}
}
<div class="container-fluid">
<div class="row">
<div class="col-xs-12 col-sm-12 slider__size">
<div class="slider__consolidado__img__position">
<img class="img-responsive img__blend__filter" src="/slider_notebook.jpeg"
alt="Crédito Família">
</div>
<div class="title__box">
<h1 class="h1__home"><span>Comece<br>a realizar<br>sonhos</span</h1>
<button class="btn-default btn-padding btn__slider__color_orange">
Saiba mais
</button>
</div>
</div>
<div class="col-xs-12 col-sm-6 form__consolidado__color">
<h2 class="form__title">Lorem Ipsum</h2>
<h3 class="form__subtitle">What's Lorem Ipsum</h3>
<form data-toggle="validator" role="form" name="contato" action="" method="POST">
<div class="form-group row">..... </div>
<div class="row">
<div class="col-sm-12 div__info__color">
<h2 class="text__blue__h2">.....</h2>
<p class="text__grey__14">......</p>
</div>
The problem of the form being under other divs can be solved by setting the "z-index" property of the div containing the form to a high value which will make the form appear on the first level
z-index: 100
.col-xs-12.col-sm-6.form__consolidado__color {
float: right;
}
I solved the float problem with margin-left:45%;
Related
I am building a website for someone and somehow I can't manage to make the image in the header stay where it's supposed to. I am using the #mobile to determine the screen width, but it works only on my computer's screen. When I move to another computer, it's always to the left or to the bottom.
Code:
#media (min-width: 1203px) {
#profile {
position: relative;
margin-top: -35.5%;
margin-left: -31%;
float: left;
padding-left: 12%
}
#mishpat {
padding-top: 150px;
}
}
#media (max-width: 1203px) {
#profile {
position: relative;
margin-top: -40.4%;
margin-left: -35%;
padding-left: 16%;
padding-top: 6%;
float: left;
}
#mishpat {
padding-top: 150px;
}
}
#media (max-width: 1025px) {
#profile {
position: relative;
margin-top: 3.5%;
margin-left: 10%;
padding-left: 16%;
padding-top: 0px;
float: left;
}
#mishpat {
padding-top: 150px;
padding-left: 0px;
}
}
#media (max-width: 991px) {
#profile {
position: relative;
margin-top: 1%;
margin-left: 8%;
float: left;
bottom: 46px;
margin-bottom: -150px;
}
}
#media (max-width: 767px) {
#profile {
position: relative;
margin-top: 2%;
margin-left: -15%;
float: left;
bottom: 46.5px;
}
}
#media (max-width: 470px) {
#profile {
position: relative;
margin-top: 18%;
margin-left: -8%;
float: left;
max-width: 100%;
padding-top: 25%;
}
}
<header class="masthead text-center text-white d-flex">
<div class="layer">
</div>
<div class="container my-auto">
<div class="row">
<div id="mishpat" class="col-lg-10 mx-auto">
<h1 class="text-uppercase">
<strong>ד"ר מריאנה ירון</strong>
</h1>
<hr>
</div>
<div class="col-lg-8 mx-auto">
<p class="text-faded mb-5">מומחית ברפואה פנימית ואנדוקרינולוגיה</p>
</div>
<div class="col-lg-10 mx-auto">
<img id="profile" src="C:\Users\alonbarel336\source\repos\WebSite1\yaron 2\img\portfolio\thumbnails\3.jpg" class="img-responsive" width="520" height="700">
</div>
</div>
</div>
</header>
And here is an image to show how it looks like:
How can I make it stop before it crosses the blue line (flow to the next row)?
the new look after fixing with bootstrap 4
To make the image responsive do this:
Replace img-responsive with img-fluid. (there's no img-responsive in Bootstrap 4)
Remove width="520" height="700".
How to achieve displaying this layout with flexbox using Bootstrap 4 (so I can strech the decoration div and menu div on desktops?)
I was using Bootstrap 3 but now I'm using Bootstrap 4 this is what I have this so far:
https://codepen.io/anon/pen/RLMKxZ
<div class="container-fluid"
style="padding: 0; background-color: #001143; color: white;">
<div class="row align-items-start">
<div class="col-xs-12 col-sm-1 evento float-left"></div>
<div id="triangulo_div" class="triangulo_div float-left">
<p class="triangulo_rectangulo">triangulo rectangulo.</p>
</div>
<div class="col-xs-12 col-sm-3 float-left menu"
style="background-color: #06184A;">
<div class="menu_subdiv"></div>
<div class="menu_subdivcont">
<div style="text-align: left; vertical-align: middle;">
<div class="menu_link">
<a class="imghover" href=".php"><img
data-alt-src="../img/contacto2.png" src="../img/contacto.png">
1. Menu</a>
</div>
<div class="menu_link" style="background-color: #4FCCE8">
<a class="imghover" href="#"><img data-alt-src="../img/hotel.png"
src="../img/hotel2.png">2. Menu</a>
</div>
</div>
</div>
</div>
<div class="col-xs-12 col-sm-3 float-left menu_siguiente"
style="background-color: #06184A;">
<div style="text-align: left; vertical-align: middle;">
<div class="menu_link">
<a class="imghover" href="seleccionar_detalles.php"><img
data-alt-src="../img/habitaciones2.png"
src="../img/habitaciones.png"> 3. Menu</a>
</div>
<div class="menu_link">
<a class="imghover" href=".php"><img
data-alt-src="../img/resumen2.png" src="../img/resumen.png"> 4.
Menu</a>
</div>
</div>
<div class="menu_siguiente_subdiv"></div>
</div>
<div class="col-sm-3 col-lg-5 float-md-right">
</div>
<div id="contenido"
class="col-xs-24 col-sm-7 float-right contenido bck_div2">
<div id="error">
</div>
<div class="formulario" style="min-height: 20em">
<h1>Content</h1>
</div>
</div>
</div>
</div>
Css:
.rwd-line {
display: none;
}
.evento {
display: block;
min-height: 7em;
background-image: url('img/imagen_horizontal.png');
background-position: center;
background-repeat: no-repeat;
-webkit-background-size: 40%;
background-size: 40%;
clear: both;
z-index: 5;
}
.atencion_cliente {
background-color: #001143;
}
.triangulo_div {
display: none;
}
.menu_link {
width: 100vw;
text-indent: 2.6em;
}
#media screen and (min-width: 576px) {
.rwd-line {
display: inline;
}
.menu_link {
width: 100%;
}
.contenido {
top: 6em;
background-color: rgba(79, 204, 232, .9);
}
.triangulo_div {
display: inline-block;
position: relative;
z-index: 5;
pointer-events: none;
padding: 0;
width: 0;
}
.triangulo_rectangulo {
width: 0;
height: 0;
text-indent: -9999px;
border-top: calc(100vh - 75px) solid white;
border-right: 4.8em solid transparent;
}
.menu_siguiente {
float: left;
}
.menu {
float: left;
padding-right: 0;
}
.menu_subdiv {
height: 6em;
vertical-align: top;
}
.menu_subdivcont {
vertical-align: bottom;
}
.menu_siguiente_subdiv {
height: calc(100vh - 268px);
float: left;
padding-right: 0;
}
.evento {
display: block;
height: calc(100vh - 75px);
background-image: url('img/imagen_vertical.png');
background-position: center;
background-position-y: 5em;
background-repeat: no-repeat;
-webkit-background-size: 60%;
background-size: 60%;
}
.container {
position: relative;
margin-bottom: 0;
padding-bottom: 0;
}
}
#media screen and (max-width: 767px) {
.menu, .menu_siguiente {
padding-left: 0;
}
}
#media screen and (min-width: 1500px) {
.imghover {
padding-left: 4em;
}
}
#media screen and (min-width: 1800px) {
.imghover {
padding-left: 6em;
}
}
.menu, .menu_siguiente a, a:hover {
color: white;
}
body, html {
height: 100% !important;
padding: 0;
margin: 0;
background-color: #001143;
}
input, select {
font-size: .9em !important;
}
.evento {
background-color: white;
}
I've tried other ways, like without flexbox succesfully but I wouldn't be able to stretch the divs
Update: here's the code for what I've also tried but it won't stretch the Decoration and Menu divs if Content div is higher and there's a blank space at the end of the page
I also updated the other example as I forgot to include a first div with Logo
https://codepen.io/anon/pen/jGzdwm
Problem: On the mobile version, the image is stretching on Portrait mode. As you can see below, it looks compressed.
On landscape mode, the image does not look stretched and looks exactly as the desktop version of the site.
I am using bootstrap and the images have class img-responsive and it does not work.
Below is the css that I wrote. I have tried setting background-size:contain, and some other approaches but did not render desired results. This project uses Coldfusion and Mura (CMS).
UPDATE
The following css is being used in an attempt to make it responsive:
#media (min-width: 1024px) #homepage .carousel .item img {
width:100%;
height:auto;
}
media (min-width:769px) and (max-width:980px) {
#homepage .carousel .item img {
max-width: 100%;
min-height: 100%;
height: auto;
margin-top: 154px !important;
}
}
#media (max-width: 751px) and (orientation: landscape) {
.override-hidden-xs1 {
display: block;
}
.carousel-inner {
width: 100% !important;
}
.fixNext {
margin-right: 0px;
}
.carouselCaption {
margin-top: 120px !important;
}
.h4Font {
font-size: 16px !important;
}
.upcoming-events-image {
max-width: 180px;
max-height: 180px;
width: 22% !important;
margin-left: 340px !important;
}
.image-margin-top {
margin-top: 170px !important;
display: inline-block;
}
}
#media (max-width: 767px) {
#homepage .carousel .item {
height: 200px;
margin-top: 241px;
}
#homepage .carousel .item img {
max-width: 100%;
height: auto;
display: block;
}
}
#media (max-width: 767px) and (orientation: landscape) {
#homepage .carousel .item {
height: 200px;
margin-top: 311px;
}
}
#media (min-width: 768px) and (max-width: 980px) {
.company-logo {
width: 400px;
}
#homepage .carousel .item img {
/*max-width: 1200px;*/
max-width: 100%;
min-height: 100%;
padding-top: 162px;
}
#homepage .carousel .carousel-caption {
margin-left: 64px;
}
.image-margin-top {
margin-top: 57px !important;
}
.changePosition {
margin-top: -193px !important;
}
}
#media (min-width: 920px) {
.company-logo {
width: 400px;
}
#homepage .carousel .item img {
/*max-width: 1200px;*/
max-width: 100%;
min-height: 100%;
}
}
Below is the coldfusion code where it calls the images form the CMS:
<div class="row carousel-inner padding-topImage">
<cfset local.iterator.reset()>
<cfset local.idx=0>
<cfloop condition="local.iterator.hasNext()">
<cfset local.item=iterator.next()>
<cfif ListFindNoCase( 'jpg,jpeg,gif,png', ListLast(local.item.getImageURL(), '.'))>
<div class="row item img-responsive<cfif local.idx eq 0> active</cfif>">
<img src="#local.item.getImageURL(argumentCollection=local.imageArgs)#" alt="#HTMLEditFormat(local.item.getTitle())#">
<cfif arguments.showCaption>
<div class="container">
<div class="carousel-caption carousel-caption1">
<div>
<!--- <h3>#HTMLEditFormat(local.item.getTitle())#</h3> --->
<div class="visible-xs">
<!---<h2>#HTMLEditFormat(local.item.getTitle())#</h2>--->
</div>
<div class="hidden-xs">#local.item.getSummary()#
<!--- #local.item.getBody()# --->
<!---<p><a class="btn btn-larg btn-primary" href="#local.item.getURL()#">Read More</a></p>--->
</div>
<!---<div class="override-hidden-xs1 carouselCaption" style="color:##000"><span class="h4Font">#HTMLEditFormat(local.item.getTitle())#</span>
</div>--->
</div>
</div>
</div>
</cfif>
</div>
<cfset local.idx++>
</cfif>
</cfloop>
</div>
UPDATE
Here is the issue I am having but I am not able to get around it.
The height is fixed and so I tried to height: auto but the images in the carousel disappears.
How would I modify the css so that the background height is dependent on the image being resize based on the screen size.
Here is the modified css:
#media (max-width: 747px){
#homepage .carousel .item img{
margin-top: 71px !important;
max-width:0px;
min-height:0%;
}/*
#homepage .carousel .item {
height:180px !important;
}*/
.carousel-inner {
height:auto;
}
}
#media (min-width: 748px){
#homepage .carousel .item img{
max-width:0px;
min-height:0%;
}/*
#homepage .carousel .item {
height:180px !important;
}*/
}
#media (max-width: 1024px) and (min-width: 768px){
#homepage .carousel .item {
width: 100% !important;
/*margin-top: 20px !important;*/
height:396px !important;
}
}
/*#media (min-width:992px) and (max-width:1363px){
#homepage .carousel .item img {
/* width: 100% !important;
margin-top: 15px !important;
max-height: auto;
max-height: 100%;
min-height: 80%;
}
}
#media (min-width:1024px) and (max-width:1255px){
}*/
#media (min-width: 1024px){
#homepage .carousel .item img {
/* width: 100% !important; */
margin-top: 15px !important;
max-height: auto;
max-height: 100%;
min-height: 80%;
}
}
#media (max-width:1263px) and (min-width:1024px){
#homepage .carousel .item{ height:500px !important; }
#homepage .carousel .carousel-caption {
left: 100px;
top: 80px;
width: 500px;
}
}
#media (min-width:1264px) and (max-width:1363px){
#homepage .carousel .item{ height:502px !important; }
#homepage .carousel .carousel-caption {
left: 99px;
top: 100px;
}
}
#media (min-width:1364px) and (max-width:1641px){
#homepage .carousel .item{ height:540px !important; }
#homepage .carousel .carousel-caption {
left: 170px;
top: 120px;
width: 500px;
}
#homepage .carousel .carousel-caption {
left: 170px;
top: 80px;
width: 500px;
}
}
#media (min-width:1642px){
#homepage .carousel .item{ height:650px !important; }
#homepage .carousel .carousel-caption {
left: 170px;
top: 120px;
width: 500px;
}
}
<div class="row carousel-inner padding-topImage">
<div class="row item myclass">
<img src="/Regal-en-us/cache/file/90A5069B-155D-0201-11BF135B13F69E9A_W1280_H500.jpg" alt="Real People, Real Solutions See how we've helped make a difference in the lives of our members.">
<div class="container">
<div class="carousel-caption carousel-caption1">
<div>
<div class="visible-xs"></div>
<div class="hidden-xs"><h1 class="titleSlide"><br>
Real People,<br>
Real Solutions</h1>
<p class="content1">See how we’ve helped make a difference in the lives of our members.</p>
<p style="font-size: 12px; color: #ffffff;"> </p>
<p><a class="btn btn-info1 styleText btn-primary" href="/index.cfm/doctor-finder/" role="button">Read More</a></p>
<!---<p style="font-size: 12px; color: #ffffff;"> </p>
<p><a class="btn btn-info" href="/index.cfm/doctor-finder/" role="button">Read More</a></p>--->
</div>
</div>
</div>
</div>
</div>
<div class="row item myclass">
<img src="/Regal-en-us/cache/file/9CFFC7AA-155D-0201-119470C3C01460AE_W1280_H500.jpg" alt="Need an Urgent Care Center? There is one right in your neighborhood – and we will help you find it.">
<div class="container">
<div class="carousel-caption carousel-caption1">
<div>
<div class="visible-xs"></div>
<div class="hidden-xs"><h1 class="titleSlide"><br>
<h1>Need an Urgent Care Center?</h1>
<p class="content1">There is one right in your neighborhood –<br>
and we will help you find it.</p>
<div class="embeddedContent oembed-provider-"> </div>
<!---<p style="font-size: 12px; color: #ffffff;"> </p>
<p><a class="btn btn-info1 styleText" href="http://oc2-web03/index.cfm/doctor-finder/" role="button">Find an Urgent Care</a></p>---><!---<p style="font-size: 12px; color: #686868;"> </p>--->
<p><a class="btn btn-info1 slideText btn-primary urgentButton" href="/index.cfm/urgent-care-finder/" role="button">Find an Urgent Care</a></p>
</div>
</div>
</div>
</div>
</div>
<div class="row item myclass active">
<img src="/Regal-en-us/cache/file/9CFD4EC1-155D-0201-11C0E45BAE92654E_W1280_H500.jpg" alt="Looking for a Doctor? We have just the right one for you.">
<div class="container">
<div class="carousel-caption carousel-caption1">
<div>
<div class="visible-xs"></div>
<div class="hidden-xs"><h1 class="titleSlide"><br>
Looking for a doctor?</h1>
<p class="content1">We have just the right one for you.</p>
<!---<p style="font-size: 12px; color: #ffffff;"> </p>
<p><a class="btn btn-info1 styleText" href="/index.cfm/doctor-finder/" role="button">Read More\\\</a></p>--->
<p style="font-size: 12px; color: #686868;"> </p>
<p><a class="btn btn-info1 slideText btn-primary" href="/index.cfm/doctor-finder/" role="button">Find a Doctor Now</a></p>
</div>
</div>
</div>
</div>
</div>
<div class="row item myclass">
<img src="/Regal-en-us/cache/file/22E66EFF-155D-0201-11F1D4090927E676_W1280_H500.jpg" alt="Snow Machines Run as Winter Winds Down">
<div class="container">
<div class="carousel-caption carousel-caption1">
<div>
<div class="visible-xs"></div>
<div class="hidden-xs"><p>Curabitur ut suscipit tellus. Maecenas rhoncus, ante vitae vehicula vestibulum, metus sapien dapibus tellus, et mattis dolor neque vitae nisl.</p>
</div>
</div>
</div>
</div>
</div>
</div>
Because of the fixed height, the following is occuring in the mobile and tablet version. I have tried to remove the item classs that is causing the issue but as mentioned, it is makes the carousel to disappear
Any help would be appreciated
As a rule of thumb, you should not specify the height for any of carousel components or set them to auto what causes the stretch is the [max/min]-height: 100% in these components:
.carousel-inner {
height:auto;
}
.carousel .item {
height: auto;
}
.carousel .item img {
height:auto;
}
This concept does not only apply to carousels. When designing classes, keep the height untouched or auto.
For example:
.give-me-the-bounty
{
width: 100%;
height:auto;
}
Set either height or width but not both. The image will scale itself and retain aspect ratio
Ok, forget the other approach, use inline styles:
<div style="background-image: url('#local.item.getImageURL(argumentCollection=local.imageArgs)#')"></div>
and then on your css use whatever styles you want
Try to add this code:
#media (max-width: 767px)
#homepage .carousel .item img {
object-fit: cover;
}
All you have to do is set the width of image and let the image fix it self and maintain the ratio.
I am making a comment section for my project and I've added display: none to answear__avatar on max-width: 980px and after that those divs are overlaping each other. How do I stop them from overlapping?
Here's my code:
.answear__wraper {
margin-bottom: 10px; }
.answear__answear, .answear__answear--dissucsion {
position: relative;
height: 100%; }
.answear__answear {
width: 100%; }
.answear__answear--dissucsion {
width: 89.4%;
float: right;
}
#media screen and (max-width: 980px) {
.answear__answear--dissucsion {
width: 95%; } }
.answear__avatar {
display: inline-block;
width: 100px;
height: 100%;
}
#media screen and (max-width: 980px) {
.answear__avatar {
display: none; } }
.answear__content {
text-align: left;
position: absolute;
}
<div class="answear_container">
<div class="answear__wraper">
<div class="answear__answear">
<div class="answear__avatar"><img src="images/user0.jpg" class="image__lg" /></div>
<div class="answear__content">
<div class="answear__user">
</div>
</div>
</div>
<div class="answear__answear--dissucsion">
<div class="answear__avatar"><img src="images/user0.jpg" class="image__lg" /></div>
<div class="answear__content">
<div class="answear__user">
</div>
</div>
</div>
</div>
</div>
Use visibility: hidden; the element will still take up the same space as before. The element will be hidden, but still affect the layout.
By using display: none; the page will be displayed as if the element is not there.
I tried making a responsive split screen on codepen. When the size of the screen is small, it gives columns otherwise you get two rows. Everything works fine on codepen. But when I try to implement this code into the code of my website, the grey area diminishes. What could possibly be the reason?
http://codepen.io/bellarose/pen/YqGZLL
HTML:
<section class="first-section">
<body>
<div class="container-info">
<h1>first screen</h1>
</div>
<div class="container-main">
<h1>second screen</h1>
</div>
</body>
</section>
<section class="second-section">
<body>
<div class="container-info1">
<h1>first screen</h1>
</div>
<div class="container-main1">
<h1>second screen</h1>
</div>
</body>
</section>
CSS:
.first-section {
height: 100%;
text-align: center;
}
.second-section {
height: 100%;
text-align: center;
}
.container-info {
display: inline-block;
position: relative;
width: 100%;
min-height: 490px;
background-color: red; }
#media (min-width: 768px) {
.container-info {
float: left;
left: 0;
top: 0;
height: 100%;
width: 50%; } }
.container-main {
display: inline-block;
position: relative;
width: 100%;
min-height: 490px;
background-color: grey; }
#media (min-width: 768px) {
.container-main {
float: right;
right: 0;
top: 0;
height: 100%;
width: 50%; } }
.container-info1 {
display: inline-block;
position: relative;
width: 100%;
min-height: 490px;
background-color: pink; }
#media (min-width: 768px) {
.container-info1 {
float: left;
left: 0;
top: 0;
height: 100%;
width: 50%; } }
.container-main1 {
display: inline-block;
position: relative;
width: 100%;
min-height: 490px;
background-color: white; }
#media (min-width: 768px) {
.container-main1 {
float: right;
right: 0;
top: 0;
height: 100%;
width: 50%; } }
Incorrect HTML syntax. First, the body tag is created one time and you cannot put it inside other elements. <body> is the main "wrapper".
Correct HTML:
<html>
<head>
... metadata
</head>
<body>
<section class="first-section">
<div class="container-info">
<h1>first screen</h1>
</div>
<div class="container-main">
<h1>second screen</h1>
</div>
</section>
<section class="second-section">
<div class="container-info1">
<h1>first screen</h1>
</div>
<div class="container-main1">
<h1>second screen</h1>
</div>
</section>
</body>
</html>
As for the gray box not appearing, it could be because you are using height: 100% without making sure that HTML/body also have height:100%. If you do not add the height to body, calculation will not work properly.
Gray box did not appear because parent (section) has a fixed height of 100% while the children overflow that height. To solve this you could change height:100% of section to min-height: 100%
P.S your CSS could be simplified to this:
* {margin: 0; padding: 0;}
html, body {height:100%;}
section {
min-height: 100%;
text-align: center;
}
section > div {
display: block;
position: relative;
width: 100%;
min-height: 490px;
}
#media (min-width: 768px) {
section div {
height: 100%;
float: left;
width: 50%;
}
}
/* coloring */
.container-info {background: red;}
.container-main {background-color: grey;}
.container-info1 {background-color: pink;}
.container-main1 {background-color: white;}
<section class="first-section">
<div class="container-info">
<h1>first screen</h1>
</div>
<div class="container-main">
<h1>second screen</h1>
</div>
</section>
<section class="second-section">
<div class="container-info1">
<h1>first screen</h1>
</div>
<div class="container-main1">
<h1>second screen</h1>
</div>
</section>
.first-section {
height: 100%;
text-align: center;
}
.second-section {
height: 100%;
text-align: center;
}
.container-info {
display: inline-block;
position: relative;
min-height: 490px;
background-color: red; }
#media (min-width: 768px) {
.container-info {
float: left;
left: 0;
top: 0;
height: 100%;
width: 50%; } }
.container-main {
display: inline-block;
position: relative;
min-height: 490px;
background-color: grey; }
#media (min-width: 768px) {
.container-main {
float: right;
right: 0;
top: 0;
height: 100%;
width: 50%; } }
#media and(max-width:767px){
.container-info1{
width:100%;
}
.container-main1{
width:100%;
}
}
.container-info1 {
display: inline-block;
position: relative;
min-height: 490px;
background-color: pink; }
#media (min-width: 768px) {
.container-info1 {
float: left;
left: 0;
top: 0;
height: 100%;
width: 50%; } }
.container-main1 {
display: inline-block;
position: relative;
min-height: 490px;
background-color: white; }
#media (min-width: 768px) {
.container-main1 {
float: right;
right: 0;
top: 0;
height: 100%;
width: 50%; } }
i just remove the width from the classes .container-info1 and .container-main1
and defined the width in the another media query which says #media and (max-width:767px)
ok try this now
<!DOCTYPE html>
<html>
<head>
<title></title>
<style>
.first-section {
height: 100%;
text-align: center;
}
.second-section {
height: 100%;
text-align: center;
}
.container-info {
display: inline-block;
position: relative;
min-height: 490px;
background-color: red; }
.container-main {
display: inline-block;
position: relative;
min-height: 490px;
background-color: grey; }
.container-info1 {
display: inline-block;
position: relative;
min-height: 490px;
background-color: pink; }
.container-main1 {
display: inline-block;
position: relative;
min-height: 490px;
background-color: white; }
#media screen and (min-width: 768px) {
.container-info {
float: left;
left: 0;
top: 0;
height: 100%;
width: 50%; }
.container-main {
float: right;
right: 0;
top: 0;
height: 100%;
width: 50%; } }
#media screen and (min-width: 768px) {
.container-info1 {
float: left;
left: 0;
top: 0;
height: 100%;
width: 50%; }
.container-main1 {
float: right;
right: 0;
top: 0;
height: 100%;
width: 50%; } }
#media screen and (max-width:767px){
.container-info1{
width:100%;
}
.container-main1{
width:100%;
}
.container-info{
width:100%;
}
.container-main{
width:100%;
}
}
</style>
</head>
<body>
<section class="first-section">
<body>
<div class="container-info">
<h1>first screen</h1>
</div>
<div class="container-main">
<h1>second screen</h1>
</div>
</body>
</section>
<section class="second-section">
<body>
<div class="container-info1">
<h1>first screen</h1>
</div>
<div class="container-main1">
<h1>second screen</h1>
</div>
</body>
</section>
</body>
</html>