My problem is that my fixed bootstrap navigation is covering 60px (the navigation's height) of my page, so it's screwing op the "padding" of the columns I have.
I tried to put margin: 60px on .section, but it just pushes the page 60px down, not resizing the page by 60px. Instead there is 60px hidden at the bottom.
There is no padding-top/bottom defined on the columns. They are defined with display: flex and align-items: center, with a div inside containing the text so it will be centered all time.
https://jsfiddle.net/fmcq9wpn/7/
CSS:
.col-lg-6 {
display: flex;
align-items: center;
.text {
padding: 0 5%;
h3 {
font-weight: bold;
padding-bottom: 10px;
}
p {
line-height: 2.0;
}
}
}
HTML:
<div class="section news">
<div class="row">
<div class="picture col-lg-6 col-md-6 col-12 col-sm-12">
</div>
<div class="col-lg-6 col-md-6 col-12 col-sm-12">
<div class="text">
<p>Mandag 27. Januar, 2019</p>
<H3>COACHING-FOREDRAGSRÆKKE PÅ UNIVERSITET</H3>
<p>Har man lyst til at vide mere om coaching fra forskellige, faglige perspektiver, arrangerer
professor
Reinhardt Stelter en foredragsrække på . . .</p>
<br> <button>Læs mere</button>
</div>
</div>
</div>
<div class="row">
<div class="news-box col-lg-6 col-md-6 col-12 col-sm-12">
<div class="text">
<p>Torsdag 5. Februar, 2019</p>
<h3>SIKKEN FEST!</h3>
<p>Tak til alle gæster, som kom og fejrede det nye års ankomst sammen med os! Det blev en
vidunderlig
fredag . . .</p><br>
<button>Læs mere</button>
</div>
</div>
<div class="picture col-lg-6 col-md-6 col-12 col-sm-12">
</div>
</div>
</div>
<nav class="navbar fixed-top navbar-light bg-light">
<a class="navbar-brand" href="#">Cpenhagen Coaching Center</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarText" aria-controls="navbarText" aria-expanded="false" aria-label="Toggle navigation">
Menu <i class="fas fa-bars"></i>
</button>
<div class="collapse navbar-collapse" id="navbarText">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" data-proofer-ignore href="/#home">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" data-proofer-ignore href="/#education">Education</a>
</li>
<li class="nav-item">
<a class="nav-link" data-proofer-ignore href="/#testimonial">Testimonial</a>
</li>
<li class="nav-item">
<a class="nav-link" data-proofer-ignore href="/#news">News</a>
</li>
<li class="nav-item">
<a class="nav-link" data-proofer-ignore href="/#signup">Sign up</a>
</li>
<li class="nav-item">
<a class="nav-link" data-proofer-ignore href="/#footer">Footer</a>
</li>
</ul>
</div>
</nav>
It's like the .section will always be the same size as the window.
I have a picture here: https://ibb.co/BgskKSb showing the layout.
Use the fullpage.js option paddingTop.
For example:
new fullpage('#fullpage', {
paddingTop: '60px'
});
Related
I have 2 nav pill buttons that are supposed to change the layout when clicked. Both layouts include the sidebar which doesn't change.
Nav pill 1 changes the layout to:
sidebar | column 1 | column 2
Nav pill 2 changes the layout to:
sidebar | col 1 | column 2 | col 3
Right now what happens is that one column will show up next to the sidebar but the others will be under it and i'm not sure why this happens
#sidebar {
/* width: 250px; */
min-height: 100vh;
max-height: 100vh;
}
#sidebar_sub_header a {
border-radius: 0;
}
#sidebar_main_content::-webkit-scrollbar {
width: 0;
height: 0;
overflow-y: scroll;
scrollbar-width: none;
-ms-overflow-style: none;
overflow-x: hidden;
}
#sidebar_main_content img {
/* border: 1px solid white; */
border: 1px solid rgba(255, 255, 255, 0.1);
height:100px;
width:100px;
}
#sidebar_footer {
align-items: center;
text-align: center;
}
#main_body_channels {
height: 100vh;
}
#main_body_token_requirement_confirmation {
height: 100vh;
}
#main_body_roles {
height: 100vh;
}
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<div class="container-fluid px-0">
<div class="row gx-0">
<nav class="col p-0 d-flex flex-column gap-1 bg-dark text-white" id="sidebar">
<!-- sidebar header -->
<div class="bg-dark text-white p-3" style="text-align: center; align-items: center;">
<h4>
sidebar header
</h4>
<div class="dropup-center dropdown p-1">
<a href="#" class="align-items-center text-white text-decoration-none dropdown-toggle" id="dropdownUser1" data-bs-toggle="dropdown" aria-expanded="false">
username
</a>
<ul class="dropdown-menu dropdown-menu-dark text-small shadow" aria-labelledby="dropdownUser1">
<li><a class="dropdown-item" href="#">Delete User Info</a></li>
<li><a class="dropdown-item" href="#">Logout</a></li>
</ul>
</div>
</div>
<hr>
<!-- sidebar sub header -->
<div class="bg-dark text-white text-center" id="sidebar_sub_header">
<ul class="nav nav-pills flex-column mb-auto text-white" id="myTab" role="tablist">
<li class="nav-item" role="presentation">
<a href="#" class="nav-link text-white active" id="server_wide_button" data-bs-toggle="tab" data-bs-target="#server_wide_requirements_pane" type="button" role="tab" aria-controls="server_wide_requirements_pane" aria-selected="true">
button 1
</a>
</li>
<li class="nav-item" role="presentation">
<a href="#" class="nav-link text-white" id="channel_specific_button" data-bs-toggle="tab" data-bs-target="#channel_specific_requirements_pane" type="button" role="tab" aria-controls="channel_specific_requirements_pane" aria-selected="false">
button 2
</a>
</li>
</ul>
</div>
<br>
<!-- sidebar main content -->
<div class="flex-grow-1 overflow-auto bg-dark text-white" style="align-items: center;" id="sidebar_main_content">
<ul class="nav flex-column mb-auto align-items-center">
<li class="nav-item">
<a href="#" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="test tooltip">
<img src="https://cdn.pixabay.com/photo/2020/02/10/11/12/smiley-4836191_1280.png" class="rounded-circle">
</a>
</li>
<br>
<li class="nav-item">
<a href="#" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="test tooltip">
<img src="https://cdn.pixabay.com/photo/2020/02/10/11/12/smiley-4836191_1280.png" class="rounded-circle">
</a>
</li>
<br>
<li class="nav-item">
<a href="#" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="test tooltip">
<img src="https://cdn.pixabay.com/photo/2020/02/10/11/12/smiley-4836191_1280.png" class="rounded-circle">
</a>
</li>
<br>
<li class="nav-item">
<a href="#" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="test tooltip">
<img src="https://cdn.pixabay.com/photo/2020/02/10/11/12/smiley-4836191_1280.png" class="rounded-circle">
</a>
</li>
<br>
<li class="nav-item">
<a href="#" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="test tooltip">
<img src="https://cdn.pixabay.com/photo/2020/02/10/11/12/smiley-4836191_1280.png" class="rounded-circle">
</a>
</li>
<br>
<li class="nav-item">
<a href="#" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="test tooltip">
<img src="https://cdn.pixabay.com/photo/2020/02/10/11/12/smiley-4836191_1280.png" class="rounded-circle">
</a>
</li>
<br>
<li class="nav-item">
<a href="#" data-bs-toggle="tooltip" data-bs-placement="right" data-bs-title="test tooltip">
<img src="https://cdn.pixabay.com/photo/2020/02/10/11/12/smiley-4836191_1280.png" class="rounded-circle">
</a>
</li>
<br>
</ul>
</div>
<!-- sidebar footer -->
<div class="p-3 bg-dark text-white" id="sidebar_footer">
<a href="#" class="btn btn-primary" id="add_bot_button" role="button" data-bs-toggle="tooltip" data-bs-placement="top" data-bs-custom-class="custom-tooltip" data-bs-title="test tooltip?">
test button
</a>
</div>
</nav>
<!-- TAB 1 -->
<div class="col tab-pane fade show active" id="server_wide_requirements_pane" role="tabpanel" aria-labelledby="server_wide_button" tabindex="0">
<div class="text-dark bg-danger" id="main_body_token_requirement_confirmation">
big main body column
</div>
<div class="p-0 d-flex flex-column gap-1 bg-secondary text-dark" id="main_body_roles">
right sidebar column
</div>
</div>
<!-- TAB 2 -->
<div class="col tab-pane fade" id="channel_specific_requirements_pane" role="tabpanel" aria-labelledby="channel_specific_button" tabindex="0">
<div class="p-0 bg-primary text-dark" id="main_body_channels">
column next to sidebar - same size?
</div>
<div class="bg-danger text-dark" id="main_body_token_requirement_confirmation">
big middle main body column
</div>
<div class="p-0 bg-secondary text-dark" id="main_body_roles">
right sidebar
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
using bootstrap 5.3.0 alpha-1
For Bootstrap tabs to work every tab-pane needs to be wrapped in a tab-content container.
For your columns; add the class container-fluid to each tab-pane, then add a row that contains your columns. In my basic example all columns are equal in width, but its easily adjustable.
I am assuming you want a full-page layout, so in CSS do:
#sidebar,
main {
height: 100vh;
max-height: 100vh;
}
Then give each container-fluid in <main> the class h-100, which is equal to height: 100%.
Next, give each row the class h-100. Add flex class align-items-stretch to make each column stretch the full available height.
Note: This snippet is build upon my answer of your previous question, not upon the code in your question.
#sidebar,
main {
height: 100vh;
max-height: 100vh;
}
.tab-pane .row .col {
background: tomato;
}
.tab-pane .row .col:nth-child(2) {
background: lightyellow;
}
<html>
<head>
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap#5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
</head>
<body>
<div class="container-fluid px-0">
<div class="row gx-0">
<div class="col-4 d-flex flex-column gap-1 bg-dark text-white" id="sidebar">
<div class="p-2">
<h5>
Sidebar header
</h5>
</div>
<nav class="">
<ul class="nav nav-pills flex-column text-center" role="tablist" aria-orientation="vertical">
<li class="nav-link rounded-0 active" data-bs-toggle="tab" data-bs-target="#tab-1" type="button" role="tab" aria-controls="tab-1" aria-selected="true">Tab #1 - 2 Columns</li>
<li class="nav-link rounded-0" data-bs-toggle="tab" data-bs-target="#tab-2" type="button" role="tab" aria-controls="tab-2" aria-selected="false">Tab #2 - 3 Columns</li>
</ul>
</nav>
<div class="flex-grow-1 overflow-auto">
sidebar scroll
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
end sidebar scroll
</div>
<div class="">
Sidebar footer
</div>
</div>
<main class="col tab-content overflow-auto">
<div class="container-fluid h-100 tab-pane fade active show" id="tab-1" role="tabpanel" aria-labelledby="tab-1" tabindex="0">
<div class="row h-100 align-items-stretch">
<div class="col">
Col 1
</div>
<div class="col">
Col 2
</div>
</div>
</div>
<div class="container-fluid h-100 tab-pane fade" id="tab-2" role="tabpanel" aria-labelledby="tab-2" tabindex="0">
<div class="row h-100 align-items-stretch">
<div class="col">
Col 1
</div>
<div class="col">
Col 2
</div>
<div class="col">
Col 3
</div>
</div>
</div>
</main>
</div>
</div>
</body>
</html>
I Need help to move the navbar to the right side, since the row is not using all the width from the parent div (container).
Also I need to make the navbar resizable on smaller screens and when the button appears to show the hidden navbar, after click on it, displays the menu on right side (currently appearing on middle).
I have already tried to use the pl-5 ml-5 classes that bootstrap 4 provides to move the navbar, but it seems these classes don't solve the problem.
I have already checked that adding more content (text, links, li, etc.) inside those rows get bigger.
Current state of the website:
https://demos.posicionart.com/silleri/
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-expand-lg navbar-light bg-light pb-0">
<div class="container">
<div class="row">
<div class="col-4 col-lg-4 ml-0">
<a class="navbar-brand" href="#">
<img src="images/landing/silieri-logo-head.png" class="d-inline-block align-top" alt="Imagen Logo Header Silieri">
</a>
</div>
<div class="col-8 col-lg-8">
<div class="row">
<p class="text-right navbar-header-footer">
<b class="welcome-title-header">Qro.</b> (442) 223 6825 | (442) 183 055 | (442) 183 1940 | <b class="welcome-title-header">León</b> (447) 432 0949 <i class="fab fa-facebook fa-lg"></i> <i class="fab fa-whatsapp fa-lg"></i> CONTÁCTANOS
</p>
</div>
<div class="row">
<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 ml-auto mr-auto">
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Proyectos</a>
</li>
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Especiales</a>
</li>
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Catálogo</a>
</li>
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Guía</a>
</li>
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Cotizador</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</nav>
I Just want to move the navbar to the right and make it responsive, since this is the first time that I'm using a navbar like this and not the default one that bootstrap 4 provides.
we can not use same structure everywhere so just replace your above code with the following code
HTML
<div class="container">
<div class="row">
<div class="col-sm-3">
<img src="images/landing/silieri-logo-head.png" class="d-inline-block align-top" alt="Imagen Logo Header Silieri">
</div>
<div class="col-sm-9">
<div class="row">
<div class="col-sm-12">
<ul class="top-navbar">
<li class=""><b class="welcome-title-header">Qro.</b> (442) 223 6825 | (442) 183 055 | (442) 183 1940</li>
<li class=""><b class="welcome-title-header">León</b> (447) 432 0949 <i class="fab fa-facebook fa-lg"></i></li>
<li class=""><i class="fab fa-whatsapp fa-lg"></i> CONTÁCTANOS</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<nav class="navbar navbar-expand-lg navbar-light pb-0">
<button class="navbar-toggler ml-auto" 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 ml-auto">
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Proyectos</a>
</li>
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Especiales</a>
</li>
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Catálogo</a>
</li>
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Guía</a>
</li>
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Cotizador</a>
</li>
</ul>
</div>
</nav>
</div>
</div>
</div>
</div>
</div>
and CSS
.top-navbar {
list-style: none;
float: right;
}
.top-navbar li {
float: left;
}
There are many ways you can actually achieve this, I have added a class to the row and add css class as
.mobile-right {
justify-content: flex-end;
}
Here is the codepen link
https://codepen.io/sohebm/pen/MdxYQx
But I would suggest you, understand how Bootstrap grid layout works and responsive utilities
You could use the flex helpers provided by bootstrap especially justify-content-end to align the menu to the right and align-items-end to align the menu to the right in small screens as well as the ml-auto class to align the navbar toggler to the right.
See below :
<!DOCTYPE html>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Silieri</title>
<meta name="description" content="Prueba Desc">
<meta name="keywords" content="Prueba, Prueba2">
<meta name="author" content="Posicionart">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="https://demos.posicionart.com/silleri/images/logosilieri.png">
<script src="https://demos.posicionart.com/silleri/js/landing/jquery-3.4.1.min.js"></script>
<script src="https://demos.posicionart.com/silleri/js/landing/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://demos.posicionart.com/silleri/css/landing/webfonts/all.min.css">
<link rel="stylesheet" type="text/css" href="https://demos.posicionart.com/silleri/css/landing/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="https://demos.posicionart.com/silleri/css/landing/styles.css">
</head>
<body><nav class="navbar navbar-expand-lg navbar-light bg-light pb-0">
<div class="container">
<div class="row">
<div class="col-4 col-lg-4 ml-0">
<a class="navbar-brand" href="#">
<img src="images/landing/silieri-logo-head.png" class="d-inline-block align-top" alt="Imagen Logo Header Silieri">
</a>
</div>
<div class="col-8 col-lg-8">
<div class="row">
<p class="text-right navbar-header-footer">
<b class="welcome-title-header">Qro.</b> (442) 223 6825 | (442) 183 055 | (442) 183 1940 | <b class="welcome-title-header">León</b> (447) 432 0949 <i class="fab fa-facebook fa-lg"></i> <i class="fab fa-whatsapp fa-lg"></i> CONTÁCTANOS
</p>
</div>
<div class="row">
<button class="ml-auto 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 justify-content-end" id="navbarSupportedContent">
<ul class="navbar-nav align-items-end">
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Proyectos</a>
</li>
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Especiales</a>
</li>
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Catálogo</a>
</li>
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Guía</a>
</li>
<li class="nav-item pb-1 pt-1 pl-2 pr-2">
<a class="nav-link" href="#">Cotizador</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</nav><section id="welcome">
<div class="jumbotron rounded-0 home-banner"></div>
</section>
<section id="main" class="container">
<div class="container">
<p class="main-title text-center">Podemos amueblar desde una oficina hasta <b class="welcome-title-header">UN CORPORATIVO</b></p>
<hr class="my-5 welcome-hr">
<p class="text-justify mb-5 welcome-message center-justified">
En Sileri nos especializamos en crear ambientes fucionales, cómodos y durables cuyo desarrollo va desde la planeación del proyecto hasta la entrega e instalación del mobiliario.
</p>
<div class="row">
<div class="col-md-4">
<img src="images/landing/banner-home-ambientes.jpg" class="main-image mb-3 img-fluid" alt="Imagen de Ambientes">
<div class="row">
<div class="col-md-2 pad-mar-0">
<div class="vr"> </div>
</div>
<div class="col-md-10 pr-5">
<h3 class="upper-letters welcome-title-card"><b class="primary-color">Ver</b> Ambientes</h3>
<p class="text-justify welcome-text-card">¿Tienes un proyecto grande en mente? Visita nuestra selección de ambientes para inspirarte. VER MÁS</p>
</div>
</div>
</div>
<div class="col-md-4">
<img src="images/landing/banner-home-catalogo.jpg" class="main-image mb-3 img-fluid" alt="Imagen de Cátalogo">
<div class="row">
<div class="col-md-2 pad-mar-0">
<div class="vr"> </div>
</div>
<div class="col-md-10 pr-5">
<h3 class="upper-letters welcome-title-card"><b class="primary-color">Ver</b> Catálogo</h3>
<p class="text-justify welcome-text-card">Encuentra piezas que funcionen, combinen y se adapten a tu proyecto y presupuesto. VER MÁS</p>
</div>
</div>
</div>
<div class="col-md-4">
<img src="images/landing/banner-home-asesoria.jpg" class="main-image mb-3 img-fluid" alt="Imagen de Asesorías">
<div class="row">
<div class="col-md-2 pad-mar-0">
<div class="vr"> </div>
</div>
<div class="col-md-10 pr-5">
<h3 class="upper-letters welcome-title-card"><b class="primary-color">Solicita</b> Asesoría</h3>
<p class="text-justify welcome-text-card">Si no sabes cuándo es el momento ideal para renovar un área de trabajo, toma el test y contáctanos. VER MÁS</p>
</div>
</div>
</div>
</div>
</div>
</section>
<section id="muebles" class="container">
<div class="container">
<div id="muebles-row" class="row pt-5 mt-5">
<div class="col-md-8 pr-0">
<h1 id="title-muebles" class="upper-letters main-title">Muebles Especiales</h1>
<hr class="muebles-hr">
<div class="container pl-0">
<p class="text-justify">Existen dentro de las empresas áreas que demandan soluciones específicas en cuestión de funcionalidad, diseño y estética; si necesitas una solución integral para tu proyecto, podemos ayudarte.</p>
</div>
<a id="btn-conoce-mas-1" class="mt-4 rounded-0 pl-5 pr-5 btn btn-dark upper-letters" href="#">Conoce <span class="primary-color">más</span></a>
</div>
<div class="col-md-4 pl-0">
<img src="images/landing/banner-home-muebles-especiales.jpg" class="muebles-image img-fluid" alt="Imagen Sección de Muebles">
<a id="btn-conoce-mas-2" class="mt-4 rounded-0 pl-5 pr-5 btn btn-dark upper-letters" href="#">Conoce <span class="primary-color">más</span></a>
</div>
</div>
</div>
</section>
<section id="testimonios" class="container">
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="row">
<div class="col-lg-10">
<img id="imagen-testimonios-1" class="mt-5 pt-5 testimonials-image img-fluid" src="images/landing/home-testimonio-am.png" alt="Imagen Sección Testimonios">
</div>
<div class="col-lg-2">
<div class="vr-testimonios"> </div>
</div>
</div>
</div>
<div class="col-md-8">
<br>
<div class="container">
<h1 id="title-testimonios" class="upper-letters main-title">Testimonios</h1>
<img id="imagen-testimonios-2" class="mt-5 pt-5 testimonials-image img-fluid" src="images/landing/home-testimonio-am.png" alt="Imagen Sección Testimonios">
<blockquote class="blockquote">
<p class="text-justify text-testimonials">Después de trabajar con ellos en el equipamento de nuestro comedor ejecutivo y de las salas de juntas del corporativo, recomiendo apliamente a Silieri Koncept por su experiencia, profesionalismo y entusiasmo en el proyecto.</p>
<b>
<footer class="blockquote-footer">
Director de compras, <cite title="Source Title">AM Consultores</cite>
</footer>
</b>
</blockquote>
</div>
</div>
</div>
</div>
</section><br>
<footer class="footer">
<div class="container">
<div class="row">
<div class="col-3 col-md-3">
<br>
<div class="vr-footer-1"> </div>
<ul>
<li class="left">Proyectos</li>
<li class="left">Muebles Especiales</li>
<li class="left">Guía</li>
</ul>
</div>
<div class="col-3 col-md-3">
<br>
<div class="vr-footer-1"> </div>
<ul>
<li class="center">Catálogo</li>
<li class="center">Mesas y escritorios</li>
<li class="center">Sillas y sofás</li>
<li class="center">Recepciones</li>
<li class="center">Áreas de Guardado</li>
<li class="center">Escolares y Capacitación</li>
<li class="center">Muros Móviles</li>
</ul>
</div>
<div class="col-3 col-md-3">
<br>
<div class="vr-footer-1"> </div>
<ul>
<li>Contacto</li>
<li>
<p>
Oficina Matriz <br>
B. Quitana 208 <br>
Col. Carretas <br>
C.P 76050 <br>
Querétaro, Qro. MX.
</p>
</li>
<li>(442) 223 6825</li>
<li>(442) 183 0555</li>
<li>(442) 183 1940</li>
<br>
<li>
<p>
Oficina León <br>
(442) 432 0949
</p>
</li>
</ul>
</div>
<div class="col-3 col-md-3">
<br>
<ul class="footer-icons pb-5">
<li id="li-icons" class="mr-3 ml-3"><i class="fab fa-facebook fa-3x"></i></li>
<li id="li-icons" class="mr-3 ml-3 pb-4"><i class="fab fa-whatsapp fa-3x"></i></li>
</ul>
<ul id="ul-brand" class="mt-4 pt-4">
<li class="upper-letters">Silieri Koncept</li>
<li>
<p>
Muebles de oficina <br>
& proyectos integrales
</p>
</li>
</ul>
</div>
</div>
</div>
<br><br><br><br>
<div class="second-footer">
<div class="container">
<div class="row">
<div class="col-3 col-md-3">
<img src="images/landing/silieri-logo-footer.png" class="d-inline-block align-top pt-2 pb-2" alt="Imagen Logo Footer Silieri">
</div>
<div class="col-9 col-md-9">
<p class="text-right mt-4 upper-letters">
2019 © Silieri Koncept. Todos los derechos reservados. Consulte nuestro aviso de privacidad
</p>
</div>
</div>
</div>
</div>
</footer>
</body>
</html>
I am working with Bootstrap 4 for the first time in a .NET MVC (Not Core) starter application. Bootstrap version updated to 4.1 within Nuget.
I need to have both a horizontal navbar at the top as well as a vertical navbar (sidebar) on the left side.
The example I have been working off of:
https://getbootstrap.com/docs/4.1/examples/dashboard/
The problem that I am having is that the sidebar only extends down as far as the main page content goes, I have been unable to get it to extend down to 100% of the page. I have tried setting the height manually both on the navbar and sidebar related divs, but it has no effect.
_Layout.cshtml :
<body>
<nav class="navbar navbar-dark fixed-top bg-dark flex-md-nowrap p-0 shadow">
<a class="navbar-brand col-sm-3 col-md-2 mr-0" href="#">Company name</a>
<ul class="navbar-nav px-3">
<li class="nav-item text-nowrap">
<a class="nav-link" href="#">Sign out</a>
</li>
</ul>
</nav>
<div class="container-fluid">
<div class="row">
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
<div class="sidebar-sticky">
<ul class="nav flex-column">
<li class="nav-item">
<a class="nav-link active" href="#">
<span data-feather="home"></span>
Dashboard <span class="sr-only">(current)</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<span data-feather="file"></span>
Orders
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<span data-feather="shopping-cart"></span>
Products
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<span data-feather="users"></span>
Customers
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<span data-feather="bar-chart-2"></span>
Reports
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<span data-feather="layers"></span>
Integrations
</a>
</li>
</ul>
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
<span>Saved reports</span>
<a class="d-flex align-items-center text-muted" href="#">
<span data-feather="plus-circle"></span>
</a>
</h6>
</div>
</nav>
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-4">
#RenderBody()
</main>
</div>
</div>
</body>
Index.cshtml:
<div class="jumbotron">
<h1>ASP.NET</h1>
<p class="lead">ASP.NET is a free web framework for building great Web sites and Web applications using HTML, CSS and JavaScript.</p>
<p>Learn more »</p>
</div>
<div class="row">
<div class="col-md-4">
<h2>Getting started</h2>
<p>
ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that
enables a clean separation of concerns and gives you full control over markup
for enjoyable, agile development.
</p>
<p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301865">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Get more libraries</h2>
<p>NuGet is a free Visual Studio extension that makes it easy to add, remove, and update libraries and tools in Visual Studio projects.</p>
<p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301866">Learn more »</a></p>
</div>
<div class="col-md-4">
<h2>Web Hosting</h2>
<p>You can easily find a web hosting company that offers the right mix of features and price for your applications.</p>
<p><a class="btn btn-default" href="https://go.microsoft.com/fwlink/?LinkId=301867">Learn more »</a></p>
</div>
</div>
How it looks (yellow line represents approx where I would expect the sidebar to extend down to):
that's a bit tricky one...
Bootstrap is using extra CSS to accomplish this Layout. It wouldn't work with Bootstrap only. They added a class ".sidebar":
.sidebar {
position: fixed;
top: 0;
bottom: 0;
left: 0;
z-index: 100;
padding: 48px 0 0;
box-shadow: inset -1px 0 0 rgba(0, 0, 0, .1);
}
Here's a Code-Pen Example:
https://codepen.io/anon/pen/oRjmBN
I also added a 'overflow-y: auto' in case the content inside the sidebar gets to long.
Hope that helps!
I'm working on an Angular 6 app and at this moment I'm trying to center an image on home screen but no matter which solution I try (from the ones I've found here) it always shows immediately next to top navbar and not vertically centered.
I tried all solutions found in this next post in app.component.html with no luck, always get the more or less the same result as can be seen in the picture:
Vertical Align Center in Bootstrap 4
Please, help me in centering vertically home image (or text or whatever I choose to put) without affecting the rest of pages that use the app.component.html template.
index.html:
<!doctype html>
<html lang="en">
<head>
<title>WFRH</title>
<base href="/">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<app>Loading...</app>
</body>
</html>
app.component.html:
<app-nav></app-nav>
<div class="jumbotron">
<div class="container d-flex h-100" style="border: 1px solid red">
<div class="row justify-content-center align-self-center text-center">
<div class="col-sm-12">
<!-- <router-outlet></router-outlet> -->
I'm centered...
</div>
</div>
</div>
</div>
<app-footer></app-footer>
home.component.html:
<img src="../../../assets/cirsa_home.png" class="img-fluid" />
nav.component.html:
<nav class="navbar navbar-expand-sm bg-dark navbar-dark pb-0">
<div class="container pb-1">
<!-- Brand -->
<a class="navbar-brand" href="{{xxxApp.xxxWebsiteUrl}}" target="_blank">
<img src="../../../assets/app_logo.png" />
</a>
<!-- Menu Toggler -->
<button style="margin-left: 10px;" class="navbar-toggler order-last order-sm-0" type="button" data-toggle="collapse"
data-target="#collapsibleNavbar">
<span class="navbar-toggler-icon"></span>
</button>
<!-- Navbar links -->
<div class="collapse navbar-collapse order-last order-sm-0" id="collapsibleNavbar" *ngIf="(isLoggedIn | async)">
<ul class="navbar-nav pull-left">
<li class="nav-item text-left hover-inverse">
<a class="nav-link text-light" href="#">
<i class="fa fa-home"></i>
<label [translate]="'wfrh_nav_home' | translate">Inicio</label>
</a>
</li>
<li class="nav-item text-left dropdown hover-inverse">
<a class="nav-link dropdown-toggle text-light" href="#" id="navbardrop" data-toggle="dropdown">
<i class="fa fa-edit"></i>
<label [translate]="'wfrh_nav_requests' | translate">Solicitudes</label>
</a>
<div class="dropdown-menu bg-dark border-0 hover-inverse">
<a [routerLink]="['/vacancy-form']" class="dropdown-item text-light" href="#">
<label [translate]="'wfrh_nav_fillvacancy' | translate">APC Cubrir vacante</label>
</a>
<a class="dropdown-item text-light" href="#">
<label [translate]="'wfrh_nav_leave' | translate">APC Excedencia</label>
</a>
<a class="dropdown-item text-light" href="#">
<label [translate]="'wfrh_nav_lactation' | translate">APC Lactancia</label>
</a>
<a class="dropdown-item text-light" href="#">
<label [translate]="'wfrh_nav_maternity' | translate">APC Maternidad</label>
</a>
<a class="dropdown-item text-light" href="#">
<label [translate]="'wfrh_nav_newcreationdailycasinos' | translate">APC Nueva Creación Diarios Casinos</label>
</a>
<a class="dropdown-item text-light" href="#">
<label [translate]="'wfrh_nav_newcreation' | translate">APC Nueva Creación</label>
</a>
<a class="dropdown-item text-light" href="#">
<label [translate]="'wfrh_nav_substitution' | translate">APC Sustitución IT</label>
</a>
<a class="dropdown-item text-light" href="#">
<label [translate]="'wfrh_nav_holidays' | translate">APC Vacaciones</label>
</a>
<a class="dropdown-item text-light" href="#">
<label [translate]="'wfrh_nav_changeofconditions' | translate">CDC Cambio Condiciones</label>
</a>
<a class="dropdown-item text-light" href="#">
<label [translate]="'wfrh_nav_evaluationsheet' | translate">HEV Hoja Evaluación</label>
</a>
<a class="dropdown-item text-light" href="#">
<label [translate]="'wfrh_nav_balanceandsettlement' | translate">PSF Saldo y Finiquito</label>
</a>
</div>
</li>
<li class="nav-item text-left hover-inverse">
<a [routerLink]="['/login']" class="nav-link text-light">
<i class="fa fa-sign-out"></i>
<label [translate]="'wfrh_nav_logoff' | translate">Cerrar sesión</label>
</a>
</li>
</ul>
</div>
<!-- Email send tester -->
<!-- <button class="btn-primary" (click)="emailMe()">Send Test Email To Me</button> -->
<!-- User menu -->
<!-- <div class="dropdown d-flex flex-grow-1" style="margin-right: 10px;" *ngIf="(isLoggedIn | async)">
<button type="button" class="btn btn-success dropdown-toggle ml-auto" data-toggle="dropdown" id="userDropdown">
{{userName | async}}
</button>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#">Link 1</a>
<a class="dropdown-item" href="#">Link 2</a>
<a class="dropdown-item" href="#">Link 3</a>
<div class="dropdown-divider"></div>
<a [routerLink]="['/login']" class="dropdown-item">Logout</a>
</div>
</div> -->
<!-- Language Selector -->
<select class="selectpicker ml-auto" data-width="65px" id="langSelect" data-style="btn-primary" #langSelect
(change)="languageChange(langSelect.value)">
<option class="flag-icon flag-icon-squared flag-icon-{{xxxApp.countryInfo[i].ISO3166_2Letter}}" style="margin-bottom: 5px; width: 65px;"
*ngFor="let lang of xxxApp.translate.getLangs(); let i = index" [value]="lang" [selected]="lang === xxxApp.translate.currentLang">
<span class="flag-icon flag-icon-squared flag-icon-{{xxxApp.countryInfo[i].ISO3166_2Letter}}"></span>
</option>
</select>
</div>
</nav>
<nav class="navbar navbar-expand-md bg-dark navbar-dark pt-0 pb-0">
<div class="container pt-0 pb-1">
<small class="username">
{{userName | async}}
</small>
</div>
</nav>
styles.css:
#import "~bootstrap/dist/css/bootstrap.min.css";
#import "~font-awesome/css/font-awesome.css";
html, body {
height: 100%;
}
You probably missunderstood the solution given in the vertical align post.
To be able to align vertically an item depending on its parent, you have to set the parent's height (that is why you see body height:100% in their example) but if, like in your html, you have many different parents, not only the parent has to have the 100% height prop, but also the children props
CSS Example :
#import "~bootstrap/dist/css/bootstrap.min.css";
#import "~font-awesome/css/font-awesome.css";
html, body, div {
height: 100%;
}
HTML Example :
<body>
<div>
<image>the centered element</image>
</div>
</body>
After researching and doing a lot of trial and error I came up with a solution that works. I hope it is useful for anyone else with this issue.
My app main template consists on an horizontal navbar header => content => horizontal navbar footer and I set a fixed height footer of 40 px so then I use a negative margin of 40px for home image so it is centered respect content div and not the whole screen (I don't like this approach very much -I mean, using negative margins- but it works):
app.component.html (the main structure):
<div class="main">
<div class="row header m-0 p-0">
<div class="col-12 m-0 p-0">
<app-nav></app-nav>
</div>
</div>
<div class="row content m-0 p-0">
<router-outlet></router-outlet>
</div>
<div class="row footer">
<app-footer></app-footer>
</div>
</div>
home.component.html:
<div style="margin-top: -40px !important;" class="pl-5 pr-5">
<img src="../../../assets/img_home.png" class="img-fluid" />
</div>
styles.css:
html, body {
height: 100%;
}
.main {
display: flex;
flex-flow: column;
height: 100%;
}
.main .row.header {
flex: 0 1 auto;
}
.main .row.content {
flex: 1 1 auto;
}
.main .row.footer {
flex: 0 1 auto;
}
And so is how the home screen looks:
I made a webpage with a "sticky" footer(the footer is at the bottom of content if the content is large, or at the bottom of the viewport if the content is small) by using flexbox. I am now trying to make it so the content will be at the center of the remaining height(vh - height of navbar - height of footer) if the content is small enough. Below is an image to demostrate what I just said.
Here is my code.
<div id="app">
<div>
<div class="d-flex flex-column full-height">
<div id="div-top" class="d-flex flex-column" style="flex: 2">
<nav class="navbar navbar-expand-md navbar-dark bg-primary sticky-top">
<div class="container">
<a class="navbar-brand" href="/">
<img class="logo d-inline-block align-top" src="https://cdn4.iconfinder.com/data/icons/new-google-logo-2015/400/new-google-favicon-256.png" width="30" height="30"> Brand</a>
<button type="button" class="navbar-toggler">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse">
<ul class="ml-auto navbar-nav">
<li class="nav-item">
<a class="nav-link" aria-current="false" href="/about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="false" href="/aaar">Ada</a>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="false" href="/bbbr">sdfsdfs</a>
</li>
</ul>
</div>
</div>
</nav>
<br>
<div class="container d-flex align-items-center justify-content-center h-100" id="div-1">
<div class="row w-100">
<div class="text-center col col-md-12 col-lg-6">
<img class="logo" src="https://cdn4.iconfinder.com/data/icons/new-google-logo-2015/400/new-google-favicon-256.png" width="256" height="256" alt="logo">
<h2 class="pt-2 pb-3 font-weight-normal">Description</h2>
<div>
Add
<p>description</p>
</div>
<p class="pt-4 text-muted">v1.0.0</p>
</div>
<div class="d-none d-lg-block col col-lg-6">test</div>
</div>
</div>
</div>
<footer class="footer">
<div class="text-center container">
<span class="d-block">Copyright © 2018</span>
<span class="text-muted">Some text here</span>
</div>
</footer>
</div>
</div>
</div>
#div-1 {
background-color: #00ff00;
}
.full-height {
height: 100vh;
}
.footer {
margin: auto auto 0 auto;
width: 100%;
padding-top: 1.2rem;
padding-bottom: 1.2rem;
background-color: #ff0000;
}
The height of the content won't change, I'm just trying to support multiple screen sizes. I have encountered 2 problems by using this approach. First, it does not work on landscape mode on mobile(emulated using chrome dev tools). Second, the navbar shrinks in height.
jsfiddle is available here. You can also compare it with the original version. Adding /embedded/result/ to the end of the url will open the result in fullscreen. Thanks for helping!
If you change the following it will work as you asked for:
change to min-height: 100vh in the .full-height rule
remove align-items-center/h-100 and add m-auto in the id="div-1" elements class list
Do note, the <br> you had after the </nav> in the markup is invalid, so i removed it. If you want a gap there, use margin's padding's
Updated fiddle
Stack snippet
#div-1 {
background-color: #00ff00;
}
.full-height {
min-height: 100vh;
}
.footer {
margin: auto auto 0 auto;
width: 100%;
padding-top: 1.2rem;
padding-bottom: 1.2rem;
background-color: #ff0000;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.css" rel="stylesheet"/>
<div id="app">
<div>
<div class="d-flex flex-column full-height">
<div id="div-top" class="d-flex flex-column" style="flex: 2">
<nav class="navbar navbar-expand-md navbar-dark bg-primary sticky-top">
<div class="container">
<a class="navbar-brand" href="/">
<img class="logo d-inline-block align-top" src="https://cdn4.iconfinder.com/data/icons/new-google-logo-2015/400/new-google-favicon-256.png" width="30" height="30"> Brand</a>
<button type="button" class="navbar-toggler">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse">
<ul class="ml-auto navbar-nav">
<li class="nav-item">
<a class="nav-link" aria-current="false" href="/about">About</a>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="false" href="/aaar">Ada</a>
</li>
<li class="nav-item">
<a class="nav-link" aria-current="false" href="/bbbr">sdfsdfs</a>
</li>
</ul>
</div>
</div>
</nav>
<div class="container d-flex justify-content-center m-auto" id="div-1">
<div class="row w-100">
<div class="text-center col col-md-12 col-lg-6">
<img class="logo" src="https://cdn4.iconfinder.com/data/icons/new-google-logo-2015/400/new-google-favicon-256.png" width="256" height="256" alt="logo">
<h2 class="pt-2 pb-3 font-weight-normal">Description</h2>
<div>
Add
<p>description</p>
</div>
<p class="pt-4 text-muted">v1.0.0</p>
</div>
<div class="d-none d-lg-block col col-lg-6">test</div>
</div>
</div>
</div>
<footer class="footer">
<div class="text-center container">
<span class="d-block">Copyright © 2018</span>
<span class="text-muted">Some text here</span>
</div>
</footer>
</div>
</div>
</div>