Absolute div under footer - html
When I add a footer field under the div, which is absolute value, this field escapes on mobile and desktop. Also, iframe doesn't have full height. What should I do?
All details are given in the attachment.
When I add a footer field under the div, which is absolute value, this field escapes on mobile and desktop. Also, iframe doesn't have full height. What should I do?
All details are given in the attachment.
Attach:
My Code:
.contact-form {
position: absolute;
z-index: 100;
left: 0;
right: 0;
margin-top: 20em;
}
.form {
background: #fff;
border-radius: 1em;
padding: 3em;
}
.maps {
z-index: 0;
position: relative;
-webkit-filter: grayscale(100%);
-moz-filter: grayscale(100%);
-ms-filter: grayscale(100%);
-o-filter: grayscale(100%);
filter: grayscale(100%);
width: 100%;
overflow: hidden;
margin-bottom: -1em;
}
.maps iframe {
width: 100%;
overflow: hidden;
height: 100vh;
}
<div class="contact-form">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="form mt-5 mb-5 d-flex flex-md-row flex-column">
<div class="col-md-5 mt-5">
<h4>İletişim</h4>
<div id="title" class="mt-5 d-flex">
<h6><i class="fas fa-paper-plane mr-2"></i>E-Posta: baris#reklamodasi.com.tr</h6>
</div>
<div id="title" class="mt-4 d-flex">
<h6><i class="fas fa-phone-alt mr-2"></i>Telefon Numarası: +90 534 613 72 62</h6>
</div>
<div id="title" class="mt-4 d-flex">
<h6><i class="fas fa-sort-numeric-up mr-2"></i>Sicil Numarası: 000010001011111100</h6>
</div>
<div id="title" class="mt-4 d-flex">
<h6><i class="fas fa-sort-numeric-down mr-2"></i>Mersis Numarası: 000010001011111100</h6>
</div>
<p class="mt-5" style="color: #939393;"><i class="fas fa-map-marker mr-2" style="color: #0097b1;"></i>Küçükbakkalköy Mh. Küçük Setli Sokak Denge Panorama Plaza. No: 5-9 Kat: 3 D:13 34750, Ataşehir - İstanbul</p>
</div>
<div class="col-md-7 mt-5 mb-4">
<div class="d-block">
<div class="input-group mb-3 mr-2">
<input type="text" class="form-control" placeholder="Adınız Soyadınız" aria-label="ad-soyad" aria-describedby="basic-addon1">
</div>
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="E-Posta" aria-label="e-mail" aria-describedby="basic-addon1">
</div>
</div>
<div class="form-group">
<label for="exampleFormControlTextarea1"></label>
<textarea placeholder="Mesajınız" class="form-control" id="exampleFormControlTextarea1" rows="10"></textarea>
</div>
<button style="width: 100%;" type="button" class="btn btn-sincap"><i class="far fa-paper-plane mr-2"></i>Gönder</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="maps">
<div class="row">
<div class="col-md-12">
<iframe class="map_h" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d24095.133376834387!2d29.11235246540525!3d40.98385285407077!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x2e8746b0ec51372a!2sReklam%20Odas%C4%B1!5e0!3m2!1str!2str!4v1595930989510!5m2!1str!2str"
frameborder="0" style="border:0;" allowfullscreen="" aria-hidden="false" tabindex="0"></iframe>
</div>
</div>
</div>
<div class="footer pb-5 text-center">
<div class="container">
<div class="row">
<div class="col-md-12 copy">
<img src="/materials/logo.svg" width="90px" height="90px">
</div>
<div class="col-md-12">
<p>All Rights Reserved 2020 | Reklam Odası</p>
</div>
</div>
</div>
</div>
thank you so much this works little bit but this time it looks like this.
Vikas Katal
When you absolute an element relative to another element try to wrap both by a parent element. It will automatically fix many issues you may face in the future.
<div class="form-map-wrapper">
<div class="contact-form">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="form mt-5 mb-5 d-flex flex-md-row flex-column">
<div class="col-md-5 mt-5">
<h4>İletişim</h4>
<div id="title" class="mt-5 d-flex"><h6><i class="fas fa-paper-plane mr-2"></i>E-Posta: baris#reklamodasi.com.tr</h6></div>
<div id="title" class="mt-4 d-flex"><h6><i class="fas fa-phone-alt mr-2"></i>Telefon Numarası: +90 534 613 72 62</h6></div>
<div id="title" class="mt-4 d-flex"><h6><i class="fas fa-sort-numeric-up mr-2"></i>Sicil Numarası: 000010001011111100</h6></div>
<div id="title" class="mt-4 d-flex"><h6><i class="fas fa-sort-numeric-down mr-2"></i>Mersis Numarası: 000010001011111100</h6></div>
<p class="mt-5" style="color: #939393;"><i class="fas fa-map-marker mr-2" style="color: #0097b1;"></i>Küçükbakkalköy Mh. Küçük Setli Sokak
Denge Panorama Plaza. No: 5-9 Kat: 3 D:13 34750, Ataşehir - İstanbul</p>
</div>
<div class="col-md-7 mt-5 mb-4">
<div class="d-block">
<div class="input-group mb-3 mr-2">
<input type="text" class="form-control" placeholder="Adınız Soyadınız" aria-label="ad-soyad" aria-describedby="basic-addon1">
</div>
<div class="input-group mb-3">
<input type="text" class="form-control" placeholder="E-Posta" aria-label="e-mail" aria-describedby="basic-addon1">
</div>
</div>
<div class="form-group">
<label for="exampleFormControlTextarea1"></label>
<textarea placeholder="Mesajınız" class="form-control" id="exampleFormControlTextarea1" rows="10"></textarea>
</div>
<button style="width: 100%;" type="button" class="btn btn-sincap"><i class="far fa-paper-plane mr-2"></i>Gönder</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="maps">
<div class="row">
<div class="col-md-12">
<iframe class="map_h" src="https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d24095.133376834387!2d29.11235246540525!3d40.98385285407077!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x0%3A0x2e8746b0ec51372a!2sReklam%20Odas%C4%B1!5e0!3m2!1str!2str!4v1595930989510!5m2!1str!2str" frameborder="0" style="border:0;" allowfullscreen="" aria-hidden="false" tabindex="0"></iframe>
</div>
</div>
</div>
</div>
Also add z-index wisely to relative and absolute elements because it can effect badly for other elements (Ex:- for Fixed Menu)
.form-map-wrapper {
position: relative;
z-index: 1;
}
.maps {
position: absolute;
z-index: 1;
}
Related
My div content gets overlapped by the next div when i switch to small devices
I'm using bootstrap and when I'm switching to small devices my content gets overlapped by the next div. I tried to change everything and put margin on my bottom of my div but nothing seems to work. I'm missing something. I'm not sure if it something with the relative potitions I tried to add so I can add my svgs in the bottom of each div. The HTML <div class="container-fluid vh-100 " id="projects"> <!-- <div class="container d-flex h-100 " id="pwrap"> --> <div class="row align-items-center mx-auto " id="cards"> <div class="col-sm-6 col-lg-4 "> <div class="card" > <img src="pics/project1.jpg" class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> Go somewhere </div> </div> </div> <div class=" col-sm-6 col-lg-4 "> <div class="card" > <img src="pics/project1.jpg" class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> Go somewhere </div> </div> </div> <div class="col-sm-6 col-lg-4 "> <div class="card"> <img src="pics/project1.jpg" class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> Go somewhere </div> </div> </div> </div> <svg class="botp" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="#FFB9B9" fill-opacity="1" d="M0,192L48,165.3C96,139,192,85,288,96C384,107,480,181,576,218.7C672,256,768,256,864,245.3C960,235,1056,213,1152,218.7C1248,224,1344,256,1392,272L1440,288L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg> <!-- </div> --> </div> <!-- /projects --> <!-- contact --> <div class="container-fluid w-100 vh-100 my-auto d-flex justify-content-center align-items-center " id="contact"> <!--Section: Contact v.2--> <div id="border-shadow"> <div class="border border-success p-3" id="bordercustom"> <section class="mb-4 " id="formcustom"> <!--Section heading--> <h2 class="h1-responsive font-weight-bold text-center my-4">Contact Me</h2> <div class="row justify-content-center"> <!--Grid column--> <div class="col-md-9 mb-md-0 mb-5"> <form id="contact-form" name="contact-form" action="mail.php" method="POST"> <!--Grid row--> <div class="row"> <!--Grid column--> <div class="col-md-6"> <div class="md-form mb-0"> <input type="text" id="name" name="name" class="form-control"> <label for="name" class="">Your name</label> </div> </div> <!--Grid column--> <!--Grid column--> <div class="col-md-6"> <div class="md-form mb-0"> <input type="text" id="email" name="email" class="form-control"> <label for="email" class="">Your email</label> </div> </div> <!--Grid column--> </div> <!--Grid row--> <!--Grid row--> <div class="row"> <div class="col-md-12"> <div class="md-form mb-0"> <input type="text" id="subject" name="subject" class="form-control"> <label for="subject" class="">Subject</label> </div> </div> </div> <!--Grid row--> <!--Grid row--> <div class="row"> <!--Grid column--> <div class="col-md-12"> <div class="md-form"> <textarea type="text" id="message" name="message" rows="2" class="form-control md-textarea"></textarea> <label for="message">Your message</label> </div> </div> </div> <!--Grid row--> </form> <div class="text-center text-md-left d-flex justify-content-center"> <a class="button mt-3" onclick="validateForm();"> <span class="default">Send</span> <span class="success">Sent</span> <div class="left"></div> <div class="right"></div> </a> </div> <div class="status"></div> </div> <!--Grid column--> </div> </div> </section> <!--Section: Contact v.2--> </div> <svg class="botc"xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="#363C62" fill-opacity="1" d="M0,288L60,272C120,256,240,224,360,224C480,224,600,256,720,277.3C840,299,960,309,1080,293.3C1200,277,1320,235,1380,213.3L1440,192L1440,320L1380,320C1320,320,1200,320,1080,320C960,320,840,320,720,320C600,320,480,320,360,320C240,320,120,320,60,320L0,320Z"></path></svg> </div> <!-- /contact --> and my css #home, #about, #projects, #contact{ position: relative; } #projects .botp{ z-index: 1; position: absolute; bottom: 0; left:0; } #cards{ z-index: 2; } #contact .botc{ position: absolute; bottom: 0; left:0; }
What browser are you using? I've run your code, and it's not overlapping (I'm using Opera/Google Chrome). Also, you can add height: auto to the divisions div, it may help :) EDIT: (I finally got what you mean) Just play with the z-index. Here is the code: CSS #home, #about, #projects, #contact { position: relative; } #projects .botp { z-index: 1; bottom: 0; left: 0; position: absolute; } #contact { z-index: 10; } #projects { z-index: 10; } .botc{ position: absolute; z-index: 1; left: 0; bottom: 200px; } #card-text { z-index: 10000; } .botp { position: absolute; z-index: 1; left: 0; bottom: 500px; z-index: 1; } .col-md-6 { z-index: 10; } index.html <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="style.css"> </head> <body> <div class="container-fluid vh-100 " id="projects"> <!-- <div class="container d-flex h-100 " id="pwrap"> --> <div class="row align-items-center mx-auto " id="cards"> <div class="col-sm-6 col-lg-4 "> <div class="card"> <img src="pics/project1.jpg" class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> Go somewhere </div> </div> </div> <div class="col-sm-6 col-lg-4"> <div class="card"> <img src="pics/project1.jpg" class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> Go somewhere </div> </div> </div> <div class="col-sm-6 col-lg-4"> <div class="card"> <img src="pics/project1.jpg" class="card-img-top" alt="..."> <div class="card-body"> <h5 class="card-title" style="z-index: 10;">Card title</h5> <p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p> Go somewhere </div> </div> </div> </div> </div> <svg class="botp" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"> <path fill="#FFB9B9" fill-opacity="1" d="M0,192L48,165.3C96,139,192,85,288,96C384,107,480,181,576,218.7C672,256,768,256,864,245.3C960,235,1056,213,1152,218.7C1248,224,1344,256,1392,272L1440,288L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"> </path> </svg> <!-- </div> --> <!-- /projects --> <!-- contact --> <div class="container-fluid w-100 vh-100 my-auto d-flex justify-content-center align-items-center " id="contact"> <!--Section: Contact v.2--> <div id="border-shadow"> <div class="border border-success p-3" id="bordercustom"> <section class="mb-4 " id="formcustom"> <!--Section heading--> <h2 class="h1-responsive font-weight-bold text-center my-4">Contact Me</h2> <div class="row justify-content-center"> <!--Grid column--> <div class="col-md-9 mb-md-0 mb-5"> <form id="contact-form" name="contact-form" action="mail.php" method="POST"> <!--Grid row--> <div class="row"> <!--Grid column--> <div class="col-md-6"> <div class="md-form mb-0"> <input type="text" id="name" name="name" class="form-control"> <label for="name" class="">Your name</label> </div> </div> <!--Grid column--> <!--Grid column--> <div class="col-md-6"> <div class="md-form mb-0"> <input type="text" id="email" name="email" class="form-control"> <label for="email" class="">Your email</label> </div> </div> <!--Grid column--> </div> <!--Grid row--> <!--Grid row--> <div class="row"> <div class="col-md-12"> <div class="md-form mb-0"> <input type="text" id="subject" name="subject" class="form-control"> <label for="subject" class="">Subject</label> </div> </div> </div> <!--Grid row--> <!--Grid row--> <div class="row"> <!--Grid column--> <div class="col-md-12"> <div class="md-form"> <textarea type="text" id="message" name="message" rows="2" class="form-control md-textarea"></textarea> <label for="message">Your message</label> </div> </div> </div> <!--Grid row--> </form> <div class="text-center text-md-left d-flex justify-content-center"> <a class="button mt-3" onclick="validateForm();"> <span class="default">Send</span> <span class="success">Sent</span> <div class="left"></div> <div class="right"></div> </a> </div> <div class="status"></div> </div> <!--Grid column--> </div> </div> </section> <!--Section: Contact v.2--> </div> </div> <!-- /contact --> <svg class="botc" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"> <path fill="#363C62" fill-opacity="1" d="M0,288L60,272C120,256,240,224,360,224C480,224,600,256,720,277.3C840,299,960,309,1080,293.3C1200,277,1320,235,1380,213.3L1440,192L1440,320L1380,320C1320,320,1200,320,1080,320C960,320,840,320,720,320C600,320,480,320,360,320C240,320,120,320,60,320L0,320Z"> </path> </svg> </body> </html> Hope this helps :)
so i randomly fixed it just by adding this code on css .card-img-top { width: 100%; height: 15vw; object-fit: cover; }
how to make my contact section responsive in mobile view
I am stuck with a problem, I made a Contact Us page , it is properly working on desktop mode but when am trying to see in mobile view it is not responsive , can anyone help me to fix this error This is the Contact Us page, I want its working on mobile view properly Contact.html <section id="contact"> <div class="row mt-5 mb-5"> <div class="col-6"> <div class="row text-white "> <div class="col-6 "> <div class="row "> <div class="col-3 icon-fot"> <i class="fas fa-map-marker-alt"></i> </div> <div class="col-9 text-form-footer"> <h3 class="font-weight-bold">Find Us</h3> <p>Mreylebon Rd,Merylebon London,NW1SH,UK</p> </div> </div> <br> <div class="row"> <div class="col-3 icon-fot"> <i class="far fa-clock"></i> </div> <div class="col-9 text-form-footer"> <h3 class="font-weight-bold">Working Hour</h3> <p style="display: inline;">Mon-Fri : 8AM-5PM</p> <p>Sat-Sun : 8AM-2PM</p> </div> </div> </div> <div class="col-6 "> <div class="row"> <div class="col-3 icon-fot"> <i class="fas fa-phone-alt"></i> </div> <div class="col-9 text-form-footer"> <h3 class="font-weight-bold">Call Us</h3> <p style="display: inline;">+123 456 7890</p> <p>+123 456 7890</p> </div> </div> <br> <div class="row"> <div class="col-3 icon-fot"> <i class="far fa-envelope"></i> </div> <div class="col-9 text-form-footer"> <h3 class="font-weight-bold">Write To Us</h3> <p style="display: inline;">Office#noise.com</p> <p>Press#noise.com</p> </div> </div> </div> </div> </div> <div class="col-6"> <form> <div class="form-row"> <div class="col"> <input type="text" class="w-100 p-2" placeholder="Your Name..."> </div> <div class="col"> <input type="text" class="w-100 p-2" placeholder="Your Email..."> </div> </div> <textarea class="w-100 p-2 mt-2" placeholder="Your Message..." rows="5" cols="50"></textarea><br /> <button class="btn btn-outline-primary btn-block text-white font-weight-bold">Send</button> </form> </div> </div> </section>
Can you please check the below code? Hope it will work for you. You need to use col-md-6 class instead of col-6 class in the parent column class like the below code. <section id="contact"> <div class="row mt-5 mb-5"> <div class="col-md-6"> <div class="row text-white "> <div class="col-6 "> <div class="row "> <div class="col-3 icon-fot"> <i class="fas fa-map-marker-alt"></i> </div> <div class="col-9 text-form-footer"> <h3 class="font-weight-bold">Find Us</h3> <p>Mreylebon Rd,Merylebon London,NW1SH,UK</p> </div> </div> <br> <div class="row"> <div class="col-3 icon-fot"> <i class="far fa-clock"></i> </div> <div class="col-9 text-form-footer"> <h3 class="font-weight-bold">Working Hour</h3> <p style="display: inline;">Mon-Fri : 8AM-5PM</p> <p>Sat-Sun : 8AM-2PM</p> </div> </div> </div> <div class="col-6 "> <div class="row"> <div class="col-3 icon-fot"> <i class="fas fa-phone-alt"></i> </div> <div class="col-9 text-form-footer"> <h3 class="font-weight-bold">Call Us</h3> <p style="display: inline;">+123 456 7890</p> <p>+123 456 7890</p> </div> </div> <br> <div class="row"> <div class="col-3 icon-fot"> <i class="far fa-envelope"></i> </div> <div class="col-9 text-form-footer"> <h3 class="font-weight-bold">Write To Us</h3> <p style="display: inline;">Office#noise.com</p> <p>Press#noise.com</p> </div> </div> </div> </div> </div> <div class="col-md-6"> <form> <div class="form-row"> <div class="col"> <input type="text" class="w-100 p-2" placeholder="Your Name..."> </div> <div class="col"> <input type="text" class="w-100 p-2" placeholder="Your Email..."> </div> </div> <textarea class="w-100 p-2 mt-2" placeholder="Your Message..." rows="5" cols="50"></textarea><br /> <button class="btn btn-outline-primary btn-block text-white font-weight-bold">Send</button> </form> </div> </div> </section>
Fixed bottom not working with parent having overflow
I'm wanting to have a sticky footer nav type of thing on the bottom of my first col-6 (within, not outside) the div. Problem is, it has overflow which seems to be preventing me from getting it to work. Closest I got to was it starting in the correct position, then it scrolled due to the overflow. I'm scratching my head a bit here. PS- Sorry there's a lot of code, I added a lot of placeholders to force the overflow so it's more authentic. .b-wrapper { border-radius: 4px; width: 90vw; height: 90vh; max-width: 1024px; max-height: 768px; } .booking-item { padding: 30px 15px 30px 15px; cursor: pointer; border-bottom: 2px solid #f5f5f5; min-height: 30px; } .tts { max-height: 650px; overflow-y: auto; } .book_apt { position: fixed; bottom: 0; width: 100%; height: 60px; line-height: 60px; /* Vertically center the text there */ background-color: #f5f5f5; } <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> <div class="container" style="height:100vh;"> <div class="row justify-content-center h-100"> <div class="col-12 my-auto mx-auto"> <div class="card"> <div class="card-body p-0"> <div class="row"> <div class="col-6 pr-0 tts"> <div class="book_apt"> <a class="btn btn-primary" href="#">Book Service</a> </div> <!-- Added a lot to force the overflow --> <div class="booking-item" id="booking"> <div class="row"> <div class="col-2"> <div class="form-check my-auto"> <input class="form-check-input" type="checkbox" value="" id="test-check"> </div> </div> <div class="col-6 my-auto"> <h6 class="mb-0 pb-0">Swedish Massage</h6> <small><i>30min</i></small> </div> <div class="col-4 my-auto text-right"> GBP £38 </div> </div> </div> <div class="booking-item" id="booking"> <div class="row"> <div class="col-2"> <div class="form-check my-auto"> <input class="form-check-input" type="checkbox" value="" id="test-check"> </div> </div> <div class="col-6 my-auto"> <h6 class="mb-0 pb-0">Swedish Massage</h6> <small><i>30min</i></small> </div> <div class="col-4 my-auto text-right"> GBP £38 </div> </div> </div> <div class="booking-item" id="booking"> <div class="row"> <div class="col-2"> <div class="form-check my-auto"> <input class="form-check-input" type="checkbox" value="" id="test-check"> </div> </div> <div class="col-6 my-auto"> <h6 class="mb-0 pb-0">Swedish Massage</h6> <small><i>30min</i></small> </div> <div class="col-4 my-auto text-right"> GBP £38 </div> </div> </div> <div class="booking-item" id="booking"> <div class="row"> <div class="col-2"> <div class="form-check my-auto"> <input class="form-check-input" type="checkbox" value="" id="test-check"> </div> </div> <div class="col-6 my-auto"> <h6 class="mb-0 pb-0">Swedish Massage</h6> <small><i>30min</i></small> </div> <div class="col-4 my-auto text-right"> GBP £38 </div> </div> </div> <div class="booking-item" id="booking"> <div class="row"> <div class="col-2"> <div class="form-check my-auto"> <input class="form-check-input" type="checkbox" value="" id="test-check"> </div> </div> <div class="col-6 my-auto"> <h6 class="mb-0 pb-0">Swedish Massage</h6> <small><i>30min</i></small> </div> <div class="col-4 my-auto text-right"> GBP £38 </div> </div> </div> <div class="booking-item" id="booking"> <div class="row"> <div class="col-2"> <div class="form-check my-auto"> <input class="form-check-input" type="checkbox" value="" id="test-check"> </div> </div> <div class="col-6 my-auto"> <h6 class="mb-0 pb-0">Swedish Massage</h6> <small><i>30min</i></small> </div> <div class="col-4 my-auto text-right"> GBP £38 </div> </div> </div> <div class="booking-item" id="booking"> <div class="row"> <div class="col-2"> <div class="form-check my-auto"> <input class="form-check-input" type="checkbox" value="" id="test-check"> </div> </div> <div class="col-6 my-auto"> Massage Therapy (60 minutes) </div> <div class="col-4 my-auto text-right"> GBP £38 </div> </div> </div> </div> </div> </div> <div class="col-6"> </div> </div> </div> </div> </div> </div>
Change position: fixed; to position: sticky; and move book_apt to the bottom of your col-6. This should do the trick. .b-wrapper { border-radius: 4px; width: 90vw; height: 90vh; max-width: 1024px; max-height: 768px; } .booking-item { padding: 30px 15px 30px 15px; cursor: pointer; border-bottom: 2px solid #f5f5f5; min-height: 30px; } .tts { max-height: 650px; overflow-y: auto; } .book_apt { position: sticky; bottom: 0; width: 100%; height: 60px; line-height: 60px; /* Vertically center the text there */ background-color: #f5f5f5; } <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> <div class="container" style="height:100vh;"> <div class="row justify-content-center h-100"> <div class="col-12 my-auto mx-auto"> <div class="card"> <div class="card-body p-0"> <div class="row"> <div class="col-6 pr-0 tts"> <!-- Added a lot to force the overflow --> <div class="booking-item" id="booking"> <div class="row"> <div class="col-2"> <div class="form-check my-auto"> <input class="form-check-input" type="checkbox" value="" id="test-check"> </div> </div> <div class="col-6 my-auto"> <h6 class="mb-0 pb-0">Swedish Massage</h6> <small><i>30min</i></small> </div> <div class="col-4 my-auto text-right"> GBP £38 </div> </div> </div> <div class="booking-item" id="booking"> <div class="row"> <div class="col-2"> <div class="form-check my-auto"> <input class="form-check-input" type="checkbox" value="" id="test-check"> </div> </div> <div class="col-6 my-auto"> <h6 class="mb-0 pb-0">Swedish Massage</h6> <small><i>30min</i></small> </div> <div class="col-4 my-auto text-right"> GBP £38 </div> </div> </div> <div class="booking-item" id="booking"> <div class="row"> <div class="col-2"> <div class="form-check my-auto"> <input class="form-check-input" type="checkbox" value="" id="test-check"> </div> </div> <div class="col-6 my-auto"> <h6 class="mb-0 pb-0">Swedish Massage</h6> <small><i>30min</i></small> </div> <div class="col-4 my-auto text-right"> GBP £38 </div> </div> </div> <div class="booking-item" id="booking"> <div class="row"> <div class="col-2"> <div class="form-check my-auto"> <input class="form-check-input" type="checkbox" value="" id="test-check"> </div> </div> <div class="col-6 my-auto"> <h6 class="mb-0 pb-0">Swedish Massage</h6> <small><i>30min</i></small> </div> <div class="col-4 my-auto text-right"> GBP £38 </div> </div> </div> <div class="booking-item" id="booking"> <div class="row"> <div class="col-2"> <div class="form-check my-auto"> <input class="form-check-input" type="checkbox" value="" id="test-check"> </div> </div> <div class="col-6 my-auto"> <h6 class="mb-0 pb-0">Swedish Massage</h6> <small><i>30min</i></small> </div> <div class="col-4 my-auto text-right"> GBP £38 </div> </div> </div> <div class="booking-item" id="booking"> <div class="row"> <div class="col-2"> <div class="form-check my-auto"> <input class="form-check-input" type="checkbox" value="" id="test-check"> </div> </div> <div class="col-6 my-auto"> <h6 class="mb-0 pb-0">Swedish Massage</h6> <small><i>30min</i></small> </div> <div class="col-4 my-auto text-right"> GBP £38 </div> </div> </div> <div class="booking-item" id="booking"> <div class="row"> <div class="col-2"> <div class="form-check my-auto"> <input class="form-check-input" type="checkbox" value="" id="test-check"> </div> </div> <div class="col-6 my-auto"> <h6 class="mb-0 pb-0">Swedish Massage</h6> <small><i>30min</i></small> </div> <div class="col-4 my-auto text-right"> GBP £38 </div> </div> </div> <div class="book_apt"> <a class="btn btn-primary" href="#">Book Service</a> </div> </div> </div> </div> <div class="col-6"> </div> </div> </div> </div> </div>
.book_apt { background-color: #ddd; position: fixed; padding: 2em; left: 50%; bottom: 8%; transform: translateX(-50%); width: 58%; z-index: 1000; }
Materialize - Button in Card won't go center
I have a card in which there is button (Start button) which won't go to the center of the card. I tried center-align class, but that won't do it. I also tried using my id and class and trying text-align: center; in my css. But that did not work either. Don't know what I'm missing. Here is what I have: This is what I want: Here is the full html: <!DOCTYPE html> <html> <head> <!--Import Google Icon Font--> <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <!--Import materialize.css--> <link type="text/css" rel="stylesheet" href="css/materialize.min.css" media="screen,projection"/> <link rel="stylesheet" type="text/css" href="css/style.css"> <!--Let browser know website is optimized for mobile--> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> </head> <body> <!--navbar--> <header> <nav> <div class="nav-wrapper light-blue darken-3"> Kviz <!-- <ul id="nav-mobile" class="left hide-on-med-and-down"> <li>test</li> </ul> --> </div> </nav> </header> <main> <div class="row"> <div class="col s12 m12 l6 xl6"> <div class="card"> <div class="card-image waves-effect waves-block waves-light"> <img class="activator" src="images/kvizslika.jpg"> </div> <div class="card-content"> <span class="card-title activator grey-text text-darken-4">Kako se radi kviz ? <a class="waves-effect light-blue darken-3 btn activator right">Instrukcije</a> </span> </div> <div class="card-reveal"> <span class="card-title grey-text text-darken-4">Instrukcije<i class="material-icons right">close</i></span> <p>Here is some more information about this product that is only revealed once clicked on.</p> <div class="card-tabs"> <ul class="tabs tabs-fixed-width"> <li class="tab"><a class="active" href="#korak1">Poeni</a></li> <li class="tab">Odgovori</li> <li class="tab">Vreme</li> </ul> </div> <div class="card-content grey lighten-4"> <div id="korak1">Test 1. Bla bla. <br/> Bla bla.</div> <div id="korak2">Test 2</div> <div id="korak3">Test 3</div> </div> </div> </div> </div> <div class="col s12 m12 l6 xl6"> <div class="card"> <div class="row"> <div class="col s12 m12"> <div class="card light-blue darken-3"> <div class="card-content white-text"> <span class="card-title naslovPrijava">Prijava</span> </div> </div> </div> <div class="col s12 m12"> <div class="card"> <div class="card-content"> <div class="row"> <div class="col s6 m6"> <div class="card pomeriKarticu light-blue darken-3 center"> <div class="card-content white-text"> <span class="card-title naslovUcesnik">Učesnik 1:</span> </div> </div> </div> </div> <form> <div class="input-field"> <input id="first_name" type="text" class="validate"> <label for="first_name">Ime</label> </div> <div class="input-field"> <input id="last_name" type="text" class="validate"> <label for="last_name">Prezime</label> </div> </form> </div> </div> </div> <div class="col s6 m6"> <div class="card"> <div class="card-content"> <div class="row"> <div class="col s6 m6"> <div class="card pomeriKarticu light-blue darken-3 center"> <div class="card-content white-text"> <span class="card-title naslovUcesnik">Učesnik 2:</span> </div> </div> </div> </div> <form> <div class="input-field"> <input id="first_name2" type="text" class="validate"> <label for="first_name2">Ime</label> </div> <div class="input-field"> <input id="last_name2" type="text" class="validate"> <label for="last_name2">Prezime</label> </div> </form> </div> </div> </div> <div class="col s6 m6"> <div class="card"> <div class="card-content"> <div class="row"> <div class="col s6 m6"> <div class="card pomeriKarticu light-blue darken-3 center"> <div class="card-content white-text"> <span class="card-title naslovUcesnik">Učesnik 3:</span> </div> </div> </div> </div> <form> <div class="input-field"> <input id="first_name3" type="text" class="validate"> <label for="first_name3">Ime</label> </div> <div class="input-field"> <input id="last_name3" type="text" class="validate"> <label for="last_name3">Prezime</label> </div> </form> </div> </div> </div> </div> <button class="btn-large waves-effect waves-light light-blue darken-3 dugmeStart" type="submit" name="action">Start <i class="material-icons right">send</i> </button> </div> </div> </div> </div> </main> <footer class="page-footer light-blue darken-4"> <div class="footer-copyright"> <div class="container"> <center> © 2017 VTŠ Apps Team </center> </div> </div> </footer> <!--Import jQuery before materialize.js--> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/materialize.min.js"></script> </body> </html> Here is the full css: body { display: flex; min-height: 100vh; flex-direction: column; background-color: rgb(232,232,232); } main { flex: 1 0 auto; } .tabs .tab a{ color:#00ACC1; } .tabs .tab a:hover,.tabs .tab a.active { background-color:transparent; color:#00ACC1; } .tabs .tab.disabled a,.tabs .tab.disabled a:hover { color:rgba(102,147,153,0.7); } .tabs .indicator { background-color:#00ACC1; } .naslovPrijava{ font-size: 20px !important; text-align: center; height: 18px; } .naslovUcesnik{ font-size: 18px !important; text-align: left; margin-left:-15px; margin-top: -15px; } .pomeriKarticu{ margin-left:-35px; height: 50px; } .dugmeStart{ text-align: center; }
You have to use the center-align class on a parent element of the button, so I added a parent with class="center-align" body { display: flex; min-height: 100vh; flex-direction: column; background-color: rgb(232, 232, 232); } main { flex: 1 0 auto; } .tabs .tab a { color: #00ACC1; } .tabs .tab a:hover, .tabs .tab a.active { background-color: transparent; color: #00ACC1; } .tabs .tab.disabled a, .tabs .tab.disabled a:hover { color: rgba(102, 147, 153, 0.7); } .tabs .indicator { background-color: #00ACC1; } .naslovPrijava { font-size: 20px !important; text-align: center; height: 18px; } .naslovUcesnik { font-size: 18px !important; text-align: left; margin-left: -15px; margin-top: -15px; } .pomeriKarticu { margin-left: -35px; height: 50px; } .dugmeStart { text-align: center; } <!DOCTYPE html> <html> <head> <!--Import Google Icon Font--> <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> <!--Import materialize.css--> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.2/css/materialize.min.css"> <link rel="stylesheet" type="text/css" href="css/style.css"> <!--Let browser know website is optimized for mobile--> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> </head> <body> <!--navbar--> <header> <nav> <div class="nav-wrapper light-blue darken-3"> Kviz <!-- <ul id="nav-mobile" class="left hide-on-med-and-down"> <li>test</li> </ul> --> </div> </nav> </header> <main> <div class="row"> <div class="col s12 m12 l6 xl6"> <div class="card"> <div class="card-image waves-effect waves-block waves-light"> <img class="activator" src="images/kvizslika.jpg"> </div> <div class="card-content"> <span class="card-title activator grey-text text-darken-4">Kako se radi kviz ? <a class="waves-effect light-blue darken-3 btn activator right">Instrukcije</a> </span> </div> <div class="card-reveal"> <span class="card-title grey-text text-darken-4">Instrukcije<i class="material-icons right">close</i></span> <p>Here is some more information about this product that is only revealed once clicked on.</p> <div class="card-tabs"> <ul class="tabs tabs-fixed-width"> <li class="tab"><a class="active" href="#korak1">Poeni</a></li> <li class="tab">Odgovori</li> <li class="tab">Vreme</li> </ul> </div> <div class="card-content grey lighten-4"> <div id="korak1">Test 1. Bla bla. <br/> Bla bla.</div> <div id="korak2">Test 2</div> <div id="korak3">Test 3</div> </div> </div> </div> </div> <div class="col s12 m12 l6 xl6"> <div class="card"> <div class="row"> <div class="col s12 m12"> <div class="card light-blue darken-3"> <div class="card-content white-text"> <span class="card-title naslovPrijava">Prijava</span> </div> </div> </div> <div class="col s12 m12"> <div class="card"> <div class="card-content"> <div class="row"> <div class="col s6 m6"> <div class="card pomeriKarticu light-blue darken-3 center"> <div class="card-content white-text"> <span class="card-title naslovUcesnik">Učesnik 1:</span> </div> </div> </div> </div> <form> <div class="input-field"> <input id="first_name" type="text" class="validate"> <label for="first_name">Ime</label> </div> <div class="input-field"> <input id="last_name" type="text" class="validate"> <label for="last_name">Prezime</label> </div> </form> </div> </div> </div> <div class="col s6 m6"> <div class="card"> <div class="card-content"> <div class="row"> <div class="col s6 m6"> <div class="card pomeriKarticu light-blue darken-3 center"> <div class="card-content white-text"> <span class="card-title naslovUcesnik">Učesnik 2:</span> </div> </div> </div> </div> <form> <div class="input-field"> <input id="first_name2" type="text" class="validate"> <label for="first_name2">Ime</label> </div> <div class="input-field"> <input id="last_name2" type="text" class="validate"> <label for="last_name2">Prezime</label> </div> </form> </div> </div> </div> <div class="col s6 m6"> <div class="card"> <div class="card-content"> <div class="row"> <div class="col s6 m6"> <div class="card pomeriKarticu light-blue darken-3 center"> <div class="card-content white-text"> <span class="card-title naslovUcesnik">Učesnik 3:</span> </div> </div> </div> </div> <form> <div class="input-field"> <input id="first_name3" type="text" class="validate"> <label for="first_name3">Ime</label> </div> <div class="input-field"> <input id="last_name3" type="text" class="validate"> <label for="last_name3">Prezime</label> </div> </form> </div> </div> </div> </div> <div class="center-align"> <button class="btn-large waves-effect waves-light light-blue darken-3 dugmeStart" type="submit" name="action">Start <i class="material-icons right">send</i> </button> </div> </div> </div> </div> </div> </main> <footer class="page-footer light-blue darken-4"> <div class="footer-copyright"> <div class="container"> <center> © 2017 VTŠ Apps Team </center> </div> </div> </footer> <!--Import jQuery before materialize.js--> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/materialize.min.js"></script> </body> </html>
You can use margin to achieve this also .dugmeStart { text-align: center; display: block;/**Added This**/ margin: 0 auto; /**Added This**/ }
Same height in row?
How can I use the same height in row that keeps the site responsive? For example I have two x_panel with rows and columns inside but the height is different, i tried use display flex, but it change inside columns... Here is a code to you understand what I'm trying to do: <link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/> <div class="row"> <div class="col-md-6 col-sm-6 col-xs-12"> <div class="x_panel tile"> <div class="x_content"> <div class="row x_title"> <h3>Ponto de Venda:<small id="node_name"></small></h3> </div> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <div class="col-md-5 col-sm-5 col-xs-12"> <h5>Período de Avaliação:</h5> </div> <div class="col-md-7 col-sm-7 col-xs-12"> <div id="reportrange" class="pull-right" style="background: #fff; cursor: pointer; padding: 5px 10px; width: 100%; text-align: center; border: 1px solid #ccc"> <i class="glyphicon glyphicon-calendar fa fa-calendar"></i> <span id="grafico_medias"></span> <b class="caret"></b> </div> </div> </div> </div> <div class="row tile_count text-center"> <div class="col-md-4 col-sm-12 col-xs-12 tile_stats_count"> <span class="count_top"><i class="fa fa-user"></i> Total de Pedestres</span> <div id="displayPedestres" class="count"></div> </div> <div class="col-md-4 col-sm-12 col-xs-12 tile_stats_count"> <span class="count_top"><i class="fa fa-eye"></i> Visualizações</span> <div id="displayInteracoes" class="count"></div> </div> <div class="col-md-4 col-sm-12 col-xs-12 tile_stats_count"> <span class="count_top"><i class="fa fa-refresh"></i> Taxa de Conversão</span> <div id="displayTaxa" class="count green"></div> </div> </div> </div> </div> </div> <!-- /Informacoes medias --> <!-- Meta --> <div class="col-md-6 col-sm-6 col-xs-12"> <div class="x_panel tile"> <div class="x_content"> <div class="row x_title"> <h3>Meta</h3> </div> <div class="col-md-7 col-sm-12 col-xs-12"> <div class="row"> <div class="col-md-3 col-sm-6 col-xs-6"> <h5>Meta do</h5> </div> <div class="col-md-9 col-sm-6 col-xs-6" style="text-align: right"> <select id="metaPeriodo" onchange="meta()" class="pull-right" style="background: #fff; cursor: pointer; padding: 5px 10px; width: 100%; text-align: center; border: 1px solid #ccc"> <option>dia</option> <option>mês</option> <option>trimestre</option> </select> </div> </div> <div class="row"> <div class="col-md-3 col-sm-6 col-xs-6"> <h5>em</h5> </div> <div class="col-md-9 col-sm-6 col-xs-6" style="text-align: right"> <select id="metaVariavel" class="pull-right" style="background: #fff; cursor: pointer; padding: 5px 10px; width: 100%; text-align: center; border: 1px solid #ccc" id="tipo_meta" onclick="meta()"> <option>pedestres</option> <option>visualizações</option> <option>taxa de conversão</option> </select> </div> </div> <br> <div class="row"> <div class="col-md-12 col-sm-12 col-xs-12"> <input id="metaInput" type="text" class="form-control has-feedback" placeholder="Insira aqui a meta" style="height: 68px; font-size: 40px; font-weight: 600; color: #73879C; text-align: center"> </div> </div> </div> <div class="col-md-5 col-sm-12 col-xs-12"> <div class="row"> <div class="sidebar-widget text-center"> <h4 style="text-align: center;">Cumprimento da Meta</h4> <canvas width="140" height="80" id="foo" class="" style="width: 150px; height: 100px;"></canvas> <div class="goal-wrapper" style="text-align: center;"> <span class="gauge-value pull-center"></span> <span id="gauge-text" class="gauge-value pull-center"></span> </div> </div> </div> </div> </div> </div> </div> <!-- /Meta --> </div> I would like to "sync" this two columns with the same height doesn't matter the size of screen, can you help me? EDIT fiddle: https://jsfiddle.net/5nzcpj3s/ I am using Bootstrap with gentelella layout
https://jsfiddle.net/frd28kk0 I added new CSS classes just to make it easier to understand. You have to play with the margins to get it better. Your flexbox idea was fine. I guess you only missed setting .so-col-1 as display: flex; as well. Boa sorte! =]
with flex-box and adding a single css class: <div class="row flexit">...</div> .flexit { display:flex; } .flexit > div { flex:1; } codepen example