I would like the div (home) to be in the middle of the page. The problem with me is that when I shrink the browser window at the bottom, the footer moves up with it and then eventually disappears underneath. And should I reduce the page in the browser, so zoom out, then you can see that the logo and the text are not in the middle.
I can't get the footer to stay at the bottom and the logo and text to be in the middle of the page.
I use Bootstrap 5
CODE: https://jsfiddle.net/esznkh4r/3/
VIDEO: https://i.imgur.com/XRAX2bq.mp4
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
height: 100%;
}
body {
min-height: 100vh;
position: relative;
display: flex;
flex-direction: column;
}
.home {
padding-top: 150px;
}
.logo {
height: 200px;
width: 200px;
border-radius: 100%;
}
.text {
text-transform: uppercase;
text-align: center;
}
footer {
position: absolute;
left: 0;
right: 0;
bottom: 0;
height:50px;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="wrapper">
<div class="home">
<div class="container">
<img class="logo d-block mx-auto mb-4" src="https://duckduckgo.com/assets/common/dax-logo.svg" alt="LOGO">
<div class="text">
<h1>TEST</h1>
<h6>BLABLABLABLABLA</h6>
</div>
</div>
</div>
</div>
<footer>
<div class="container d-flex flex-wrap justify-content-between align-items-center py-3">
<div class="col-md-4 d-flex align-items-center">
<span>TEST</span>
</div>
<ul class="nav col-md-4 justify-content-end d-flex">
<a class="mb-0 justify-content-end" target="_blank">TEST</a>
</ul>
</div>
</footer>
Try like this.
Set flex property into .wrapper.
Code
You can try this, remove .home class style, and add
.wrapper {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
}
Just added some property in .home class
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
html {
height: 100%;
}
body {
min-height: 100vh;
position: relative;
display: flex;
flex-direction: column;
}
.home {
padding: 150px 0;
flex: 1;
align-items: center;
justify-content: center;
}
.logo {
height: 200px;
width: 200px;
border-radius: 100%;
}
.text {
text-transform: uppercase;
text-align: center;
}
footer {
position: absolute;
left: 0;
right: 0;
bottom: 0;
height:50px;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.2.0/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Home</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="wrapper">
<div class="home">
<div class="container">
<img class="logo d-block mx-auto mb-4" src="https://duckduckgo.com/assets/common/dax-logo.svg" alt="LOGO">
<div class="text">
<h1>TEST</h1>
<h6>BLABLABLABLABLA</h6>
</div>
</div>
</div>
</div>
<footer>
<div class="container d-flex flex-wrap justify-content-between align-items-center py-3">
<div class="col-md-4 d-flex align-items-center">
<span>TEST</span>
</div>
<ul class="nav col-md-4 justify-content-end d-flex">
<a class="mb-0 justify-content-end" target="_blank">TEST</a>
</ul>
</div>
</footer>
Related
I am trying to create my own portfolio website. Everything was fine since I tried to put the ib image with the text that says Ib student. I tried to use bootstrap box model first, that doesn't work. Then I tried using float, but that also didn't work. Text always shows at the top of the page and if I try to change its position with position: absolute when I resize the page its position gets to somewhere I don't want. To sum up, how can I put these together
How it looks like:
body {
text-align: center;
color: #FFF5FD;
}
header {
background-color: #FF96AD;
}
header h1 {
color: #FFF5FD;
font-family: 'Dancing Script', cursive;
font-size: 6rem;
padding-top: 16px;
}
header img {
width: 16%;
border-radius: 60%;
margin-top: 30px;
min-width: 200px;
}
.navbar-brand {
padding-top: 6px;
padding-bottom: 6px;
margin-bottom: 3px;
}
.capton {
font-size: 1.3rem;
margin-top: 18px;
font-family: 'Spartan', sans-serif;
font-weight: 600;
}
.ib {
width: 6%;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<header id="home">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#home">Batı Gözen</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-link active" aria-current="page" href="#">Home</a>
<a class="nav-link" href="#">My Work</a>
<a class="nav-link" href="#">CV</a>
</div>
</div>
</div>
</nav>
<img src="https://via.placeholder.com/300.jpg/" alt="My Picture">
<h1>Batı Gözen</h1>
<p class="capton">"Web Developer, Video Editor"</p>
<div class="row row-cols-lg-2 row-cols-md-2 row-cols-sm-1 row-cols-1">
<div class="col">
<img src="https://via.placeholder.com/400.jpg/" alt="IB" class="ib">
</div>
<div class="col">
<h3> IB Student, 12.th Grade</h3>
</div>
</div>
</header>
<section id="resume">
<h3>My Resume</h3>
</section>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous">
body {
text-align: center;
color: #FFF5FD;
}
header {
background-color: #FF96AD;
}
header h1 {
color: #FFF5FD;
font-family: 'Dancing Script', cursive;
font-size: 6rem;
padding-top: 16px;
}
header img {
width: 16%;
border-radius: 60%;
margin-top: 30px;
min-width: 200px;
}
.navbar-brand {
padding-top: 6px;
padding-bottom: 6px;
margin-bottom: 3px;
}
.capton {
font-size: 1.3rem;
margin-top: 18px;
font-family: 'Spartan', sans-serif;
font-weight: 600;
}
.ib {
width: 6%;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous">
<header id="home">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<div class="container-fluid">
<a class="navbar-brand" href="#home">Batı Gözen</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavAltMarkup">
<div class="navbar-nav">
<a class="nav-link active" aria-current="page" href="#">Home</a>
<a class="nav-link" href="#">My Work</a>
<a class="nav-link" href="#">CV</a>
</div>
</div>
</div>
</nav>
<img src="https://via.placeholder.com/300.jpg/" alt="My Picture">
<h1>Batı Gözen</h1>
<p class="capton">"Web Developer, Video Editor"</p>
<!--<div class="row row-cols-lg-2 row-cols-md-2 row-cols-sm-1 row-cols-1">
<div class="col">
<img src="https://via.placeholder.com/400.jpg/" alt="IB" class="ib">
</div>
<div class="col">
<h3> IB Student, 12.th Grade</h3>
</div>
</div>-->
<div class="row">
<div class="col d-flex">
<img class="ms-auto" src="https://via.placeholder.com/400.jpg/" alt="IB" class="ib">
</div>
<div class="col d-flex">
<h3 class="my-auto me-auto"> IB Student, 12.th Grade</h3>
</div>
</div>
</header>
<section id="resume">
<h3>My Resume</h3>
</section>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous">
Maybe you want this type of result.
To get this result I have commented out your code snippet and insert mine check that out. Also you can customize left and right using the ms-auto and me-auto to adjust the margin in the left nad right.
I'm making a web page but I'm having a hard time making it responsive and fit my desires.
I'm making a login page with an alert box, the alert will only appear if the user types a wrong password or email.
What I want to happen is for the main div (flex-3) content to be centered on the page and when the alert (flex-2) appears for the page to not have a scroll wheel, so flex-3 kinda has to calculate the remaining height of the page and be centered, and obviously all of this has to work no matter the device resolution.
I tried doing this with flex div but the closest I got made so the alert increased the total height of the page, so it would have a scroll wheel with no content at the bottom.
html,
body {
color: #fff;
height: 100%;
min-height: 100%;
}
.flex-1 {
flex: 1;
background-color: red;
}
.flex-2 {
display: flex;
background-color: green;
}
.flex-3 {
display: flex;
background-color: black;
}
<html>
<head>
<!-- import bootstrap css -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css">
<!-- import jquery and bootstrap -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
</head>
<body class="d-flex flex-column">
<header>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<a class="navbar-brand" href="#">
<img src="" class="d-inline-block align-top" alt="">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse justify-content-end" id='navbarNav'>
<ul class="navbar-nav navbar-right">
<li class="nav-item active">
<a class="nav-link" href="#">Home</a>
</li>
</ul>
</div>
</nav>
</header>
<main class="flex-1">
<div class="flex-2 d-flex alert-test">
<h1>TEST</h1>
</div>
<div class="flex-3 d-flex justify-content-center align-items-center">
<h1>TEST</h1>
</div>
</main>
</body>
</html>
This is how I made your solution working.
Added display: flex; flex-direction: column; to flex-1 to make the 2nd point working.
Added flex-grow: 1 to flex-3 class to make the dive stretch in remaining area.
Only by adding display: flex to the parent class flex-1, the flex grow property of child class, flex-3 works.
Hope this is the solution that you are looking for.
html,
body {
color: #fff;
height: 100%;
min-height: 100%;
}
.flex-1 {
display: flex;
flex-direction: column;
flex: 1;
background-color: red;
}
.flex-2 {
display: flex;
background-color: green;
}
.flex-3 {
display: flex;
flex-grow: 1;
overflow: auto;
background-color: black;
}
<!-- import bootstrap css -->
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"
/>
<!-- import jquery and bootstrap -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"></script>
<body class="d-flex flex-column">
<header>
<nav class="navbar navbar-expand-md navbar-dark bg-dark">
<a class="navbar-brand" href="#">
<img src="" class="d-inline-block align-top" alt="" />
</a>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#navbarNav"
aria-controls="navbarNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div
class="collapse navbar-collapse justify-content-end"
id="navbarNav"
>
<ul class="navbar-nav navbar-right">
<li class="nav-item active">
<a class="nav-link" href="#">Home</a>
</li>
</ul>
</div>
</nav>
</header>
<main class="flex-1">
<div class="flex-2 d-flex alert-test">
<h1>flex-2 TEST</h1>
</div>
<div class="flex-3 d-flex justify-content-center align-items-center">
<h1>flex-3 Test</h1>
</div>
</main>
</body>
I have a bootstrap 4 website (https://sedomadrid2021.com) which has a navbar, the navbar has an odd issue on apple mobile devices: On the home page the navbar does not seem able to push all the content down and some of the menu gets overlapped by the content placed below, on the "ponentes" page, the content just doesn't get pushed down.
This is my home html:
<body>
<div class="outer">
<nav class="navegacion navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="https://sedomadrid2021.com">
<img src="/img/logo.png" alt="logo" height="110px">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mx-auto">
<li class="nav-item active mr-5 ml-5">
<a class="nav-link btnreg" href="https://sedomadrid2021.com">Inicio <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item mr-5 ml-5">
<a class="nav-link btnreg" href="https://sedomadrid2021.com/ponentes">Ponentes<span class="sr-only"></span></a>
</li>
<li class="nav-item mr-5 ml-5">
<a class="nav-link btnreg" href="https://sedomadrid2021.com/CartaSEDO.pdf">Infórmate</a>
</li>
<li class="nav-item mr-5 ml-5">
<a class="nav-link btninscrib" href="https://atlanta.eventszone.net/myCongress/form.php?thisFormCongress=sedo21&thisFormLanguage=es">Inscríbete</a>
</li>
</ul>
</div>
</nav>
<div class="contenedor-principal">
<div class="contenedor-texto-principal">
<span class="texto-titulo-principal">
¿Te lo vas<br>a perder?<br>
</span>
<span class="texto-parrafo-principal">
<br>El 67º congreso de la sedo 2021 en Madrid congregará a los mejores profesionales de la ortodoncia de España en un evento de reencuentro cooperación y conocimiento
</span>
</div>
<div class="contenedor-bocadillo">
<img class="fondo-bocadillo" src="/img/bocadillo.png" alt="fondo-texto">
<span class="texto-bocadillo">Que no te<br>lo cuenten</span>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
this is my "ponentes" page html:
<body>
<div class="outer">
<nav class="navegacion navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="https://sedomadrid2021.com">
<img src="/img/logo.png" alt="logo" height="110px">
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mx-auto">
<li class="nav-item mr-5 ml-5">
<a class="nav-link btnreg" href="https://sedomadrid2021.com">Inicio <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item active mr-5 ml-5">
<a class="nav-link btnreg" href="https://sedomadrid2021.com/ponentes">Ponentes<span class="sr-only"></span></a>
</li>
<li class="nav-item mr-5 ml-5">
<a class="nav-link btnreg" href="https://sedomadrid2021.com/CartaSEDO.pdf">Infórmate</a>
</li>
<li class="nav-item mr-5 ml-5">
<a class="nav-link btninscrib" href="https://atlanta.eventszone.net/myCongress/form.php?thisFormCongress=sedo21&thisFormLanguage=es">Inscríbete</a>
</li>
</ul>
</div>
</nav>
<div class="contenedor-ponentes">
<div class="titulo-precongreso">
<h2>Precongreso</h2>
</div>
<div class="row">
<div class="col-sm-6">
<img class="imgponente" src="/img/ponentes/pre-ewaczochrowska.jpg" alt="Ewa Czochrowska">
<h4>Ewa Czochrowska</h4>
</div>
<div class="col-sm-6">
<img class="imgponente" src="/img/ponentes/pre-rafiromano.jpeg" alt="Rafi Romano">
<h4>Rafi Romano</h4>
</div>
</div>
<div class="titulo-congreso">
<h2>Congreso</h2>
</div>
<div class="row fila1congreso">
<div class="col-sm-4">
<img class="imgponente-cong" src="/img/ponentes/wassimbouzid.jpeg" alt="Wassim Bouzid">
<h4>Wassim Bouzid</h4>
</div>
<div class="col-sm-4">
<img class="imgponente-cong" src="/img/ponentes/luiscarriere.jpeg" alt="Luis Carriere">
<h4>Luis Carriere</h4>
</div>
<div class="col-sm-4">
<img class="imgponente-cong" src="/img/ponentes/tommasocastroflorio.jpeg" alt="Tomasso Castroflorio">
<h4>Tomasso Castroflorio</h4>
</div>
</div>
<div class="row fila2congreso">
<div class="col-sm-4">
<img class="imgponente-cong" src="/img/ponentes/alvaroferrando.jpeg" alt="Alvaro Ferrando">
<h4>Álvaro Ferrando</h4>
</div>
<div class="col-sm-4">
<img class="imgponente-cong" src="/img/ponentes/raulferrando.jpeg" alt="Raul Ferrando">
<h4>Raúl Ferrando</h4>
</div>
<div class="col-sm-4">
<img class="imgponente-cong" src="/img/ponentes/alejandroramirez.jpeg" alt="Alejandro Ramirez">
<h4>Alejandro Ramírez</h4>
</div>
</div>
<div class="row fila2congreso">
<div class="col-sm-4">
<img class="imgponente-cong" src="/img/ponentes/pabloramirez.jpeg" alt="Pablo Ramirez">
<h4>Pablo Ramirez</h4>
</div>
<div class="col-sm-4">
<img class="imgponente-cong" src="/img/ponentes/jeanlouisraymond.jpeg" alt="Jean Louis Raymond">
<h4>Jean Louis Raymond</h4>
</div>
<div class="col-sm-4">
<img class="imgponente-cong" src="/img/ponentes/arturovela.jpeg" alt="Arturo Vela">
<h4>Arturo Vela</h4>
</div>
</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
And this is my CSS
#font-face {
font-family: "Rotunda-Regular";
src: url(fonts/RotundaRegular.otf) format("opentype");
}
#font-face {
font-family: Rotunda-ExtraBoldItalic;
src: url(fonts/RotundaExtraBoldItalic.otf) format("opentype");
}
#font-face {
font-family: Rotunda-Light;
src: url(fonts/RotundaLight.otf) format("opentype");
}
body{
background-color: #fff;
}
.outer{
display: flex;
flex-flow: column;
height: 100%;
}
.navegacion{
margin-right: 8%;
margin-left: 8%;
margin-top: 4%;
background-color: #fff !important;
}
.navegacion li{
font-family: "Rotunda-Regular";
text-transform: uppercase;
color: #141b4d;
font-size: 1.35em;
}
.contenedor-principal{
flex-grow : 1;
background-image: url(/img/fondo-lg.png);
background-size: cover;
background-repeat: no-repeat;
}
.contenedor-texto-principal{
position: absolute;
left: 8%;
width: 20%;
top: 30%;
}
.texto-titulo-principal{
font-family: "Rotunda-ExtraBoldItalic";
font-size: 3em;
line-height: 1.25em;
color: #f2827f;
}
.texto-parrafo-principal{
font-family: "Rotunda-Light";
font-size: 1.25em;
color: #666666;
}
.fondo-bocadillo{
position: absolute;
z-index: 10001;
height: 250px;
}
.contenedor-bocadillo{
width: 20%;
position: absolute;
z-index: 10000;
left: 70%;
top: 65%;
}
.texto-bocadillo{
padding-left: 4%;
padding-top: 20%;
position: absolute;
color: #ffc845;
font-family: "Rotunda-ExtraBoldItalic";
font-size: 3em;
text-align: center;
z-index: 10002;
}
.btninscrib{
font-family: "Rotunda-ExtraBoldItalic";
color: #f2827f !important;
background-color: #7248bd;
border-radius: 15px;
padding-top: 15px;
padding-bottom: 15px;
padding-left: 30px !important;;
padding-right: 30px !important;
}
.btnreg{
padding-top: 20px !important;
}
.contenedor-ponentes{
margin-right: 7%;
margin-left: 7%;
margin-bottom: 5%;
text-align: center;
}
.imgponente{
width: 55%;
}
.titulo-precongreso{
color: #f2827f;
font-family: "Rotunda-ExtraBoldItalic";
padding-top: 2%;
padding-bottom: 3%;
}
.titulo-precongreso h2{
font-size: 3em !important;
}
.titulo-congreso{
color: #34a798;
font-family: "Rotunda-ExtraBoldItalic";
padding-top: 6%;
padding-bottom: 2%;
}
.titulo-congreso h2{
font-size: 3em !important;
}
.imgponente-cong{
width: 60%;
}
.fila2congreso{
padding-top: 5%;
}
.contenedor-ponentes h4{
font-family: "Rotunda-Regular";
padding-top: 5%;
}
#media (min-width: 320px) and (max-width: 768px) {
.contenedor-ponentes{
position: relative;
}
.contenedor-principal{
background-image: url(/img/fondo-sm.png);
background-size: cover;
}
.contenedor-texto-principal{
position:relative;
width: 80%;
left: 8%;
top: 20%;
}
.contenedor-bocadillo{
width: 80%;
left: 3%;
top: 120%;
}
.fondo-bocadillo{
height: 250px;
}
}
As I've mentioned, this issue is only happening on mobile apple devices. On android phones, windows desktops and apple desktops, everything is looking fine. This is a very simple webpage, you are able to navigate and visit the site directly if you want to replicate the issue.
Quick reply before looking into it more: this issue is also happening on Windows 10 using latest Firefox by just resizing the browser window. So it is not a Apple mobile issue only.
Possible fix:
So what I can see is that you are using position: absolute quite a lot on the main page. This seems to be breaking the dropdown menu (for good reasons).
Maybe change those to something else, because the absolute is what it says: absolute. Meaning it will stay where it is, no matter what happens around it.
solution: The issue was because I was placing the navbar inside the "outer" div which is a flex div.
I am trying to position my content under my navbar and when I add the padding-top: 60px; it works but pushes the navbar down. I also need the background to be at the top of the page behind the navbar. How can I fix this? The content for the page including the navbar AND background are pushed down but I need the navbar and the background at the top of the page and only the content pushed down.
body {
padding-top: 65px;
margin: 0;
width: 100%;
}
#header {
background-color: grey;
opacity: .7;
width: 100%;
height: 80px;
position: fixed;
z-index: 1000;
}
#logo a {
font-size: 30px;
font-weight: bold;
color: rgb(255, 255, 255);
font-family: 'DIN 1451 Std Engschrift';
margin-top: 5px;
}
#slide1 {
width: 100%;
background: url('sunrise.png') 50% 0 no-repeat fixed;
background-size: cover;
color: #ffffff;
height: 700px;
margin: 0;
padding: 40px 0 260px 0;
}
.content {
margin: 0 auto;
width: 1000px;
}
<div id="header">
<div class="content">
<nav id="nav" class="navbar navbar-expand-lg">
<div id="logo">
<a class="navbar-brand" href="#">Navbar Logo</a>
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div id="logo">
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<a class="nav-item nav-link" href="#slide3">How it Works</a>
<a class="nav-item nav-link" href="#slide4">For Landlords</a>
<a class="nav-item nav-link" href="#">F.A.Q</a>
<a class="nav-item nav-link" href="#pricingslide">Pricing</a>
</li>
</ul>
</div>
</div>
</nav>
</div>
</div>
<body>
<div id="slide1">
<div class="content">
<h1 id="headline">Use Your Rent To Buy A Home</h1>
<p id="subtitle">Build a credit history, create a down payment,<br> all by just making rent payments thru LikeHome</p>
<h3>Find out how soon you can become a homeowner?</h3>
<%= render '_how_much_buying_form.html.erb' %>
</div>
</div>
</body>
</html>
Do this work for you?
body {
margin: 0;
width: 100%;
}
#slide1 {
background: url('http://res.cloudinary.com/sayob/image/upload/v1526907328/483257_vwhhfw.jpg') 50% 0 no-repeat fixed;
background-size: cover;
color: #ffffff;
height: 700px;
padding: 40px;
margin-top: 20px;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
<nav id="nav" class="navbar navbar-expand-lg navbar-dark bg-dark fixed-top">
<div id="logo">
<a class="navbar-brand" href="#">Navbar Logo</a>
</div>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="#slide3">How it Works</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#slide4">For Landlords</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">F.A.Q</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#pricingslide">Pricing</a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid" id="slide1">
<h1 id="headline">Use Your Rent To Buy A Home</h1>
<p id="subtitle">Build a credit history, create a down payment,<br> all by just making rent payments thru LikeHome</p>
<h3>Find out how soon you can become a homeowner?</h3>
</div>
First of all you need to correct the HTML markups. All html contents must be inside tag. Wrap the elements in a body tag, and create another div or section for contents followed by the header. And give padding to that div.
I am trying to create a layout where I have a header (nav) of fixed height in px, a footer of fixed px as well and a div in between them that occupies the remaining space.
Broken Demo: http://jsfiddle.net/murid/0vcyqm3y/
What I'm trying to achieve is for that blue div to go all the way down to the footer. Keeping in mind that I'm using a "push" div to get the footer to sit at the bottom of the page in case the content of the page is short and that said content can be very long as well therefore pushing the footer down.
I've checked out similar questions on Stackoverflow but answers involve position absolute, JavaScript, or background color on the body, I'm trying to avoid all of these and have a simple CSS only solution with background color on the content div.
I'm using Bootstrap btw.
CSS and HTML:
html,
body {
height: 100%;
}
#wrap {
min-height: 100%;
height: auto !important;
height: 100%;
margin-bottom: -50px;
}
nav.navbar {
margin-bottom: 0;
}
section {
padding: 10px 0;
margin-left: -15px;
margin-right: -15px;
}
.section-primary {
background: #337ab7;
}
section > .row {
margin-left: 0;
margin-right: 0;
}
footer,
.push {
height: 50px;
}
<div id="wrap">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="">Logo</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
Logout
</li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid">
<section class="section-md section-primary">
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
<div class="panel panel-default">
<div class="panel-body">
Panel Body
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
<div class="push"></div>
</div>
<footer>
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="">Copyright</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
Logout
</li>
</ul>
</div>
</div>
</nav>
</footer>
I have to say I'm not a fan of this.. but this is the only CSS solution I know..
http://codepen.io/pacMakaveli/pen/EjWXNw?editors=110
Otherwise, for a cleaner way, use flexbox.
html,
body {
height: 100%;
}
#wrap {
height: 100%;
display: table;
width: 100%;
border: 2px solid green;
}
#wrap > nav,
footer {
display: table-row;
}
nav.navbar {
margin-bottom: 0;
}
section {
padding: 10px 0;
margin-left: -15px;
margin-right: -15px;
}
.section-primary {
background: #337ab7;
}
.content {
border: 3px solid red;
display: table-cell;
height: 100%;
}
section > .row {
margin-left: 0;
margin-right: 0;
}
<div id="wrap">
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="">Logo</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
Logout
</li>
</ul>
</div>
</div>
</nav>
<div class="content">
<div class="container-fluid">
<section class="section-md section-primary">
<div class="row">
<div class="col-sm-12">
<div class="row">
<div class="col-sm-8 col-sm-offset-2 col-md-6 col-md-offset-3">
<div class="panel panel-default">
<div class="panel-body">
Panel Body
</div>
</div>
</div>
</div>
</div>
</div>
</section>
</div>
</div>
<footer>
<nav class="navbar navbar-inverse navbar-static-top" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="">Copyright</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<li>
Logout
</li>
</ul>
</div>
</div>
</nav>
</footer>
</div>