How can I position a div box right under another div box? - html

I have a problem with the positioning (?) of my div boxes. I have a div box for my navigation bar.
I want a div box right under the navigation bar in the center, which can be filled with some text.
I tried:
.navigation {
background-color: black;
position: fixed;
width: 1920px;
left: 0px;
top: 0px;
}
.inhalt {
position: realative;
margin: 0px auto;
width: 600px;
top: 600px;
background-color: white;
}
<div class="navigation">
<table>
<tr>
<th><img src="logo.jpeg"></th>
<th></th>
<th></th>
<th>Startseite</th>
<th>Beats</th>
<th>Preise</th>
<th>Kontakt</th>
</tr>
</table>
</div>
Thanks for any answer!!

1- first, .inhalt class position must be "relative" not "position:realative;" as you have written above so the "top" property could work.
2- give height to your second box so you can see it.
3- When elements are positioned, they can overlap other elements. you can solve this by either give your navigation bar "sticky" position or if you want to use fixed position, use "top" property to solve the problem. I add a snippet for this solution.
4- you can use first give your navigation bar relative position and then on scrolling give it a fixed position. see the example on codepen.
.navigation{
background-color: black;
position: fixed;
width: 100%;
left: 0px;
top: 0px;
z-index: 99999;
}
.inhalt{
position:relative;
width: 600px;
height: 500px;
top: 30px;
margin: 0px auto;
background-color: lightblue;
}
<div class="navigation">
<table>
<tr>
<th><img src="logo.jpeg"></th>
<th></th>
<th></th>
<th>Startseite</th>
<th>Beats</th>
<th>Preise</th>
<th>Kontakt</th>
</tr>
</table>
</table>
</div>
<div class="inhalt"></div>

Your question is vague, but this should give you some idea to work with:
.navigation {
background-color: black;
float: left;
position: fixed;
width: 1920px;
left: 0px;
top: 0px;
float: left
}
.inhalt {
float: left;
text-align: center;
top: 15%;
left: 10%;
margin: 0px auto;
width: 100%;
background-color: white;
font-size: 20px;
}
<div id="wrapper">
<div class="navigation">
<table>
<tr>
<th><img src="logo.jpeg"></th>
<th></th>
<th></th>
<th>Startseite</th>
<th>Beats</th>
<th>Preise</th>
<th>Kontakt</th>
</tr>
</table>
</div>
<div class="inhalt">
<p> Some random Text </p>
</div>
</div>
Also you should prefer using lists <li> for your navigation, since tables can be a nightmare to work with in that particular usecase.

Ok so in addition to what explained Phanti, your HTML has an issue as there are two times the closing tab
That would be my CSS I removed some of the instructions that were not making sense to me like the fix width:
.navigation {
background-color: black;
float: left;
position: fixed;
width: 100%;
height:40px;
left: 0px;
top: 0px;
float: left
}
.inhalt {
float: left;
text-align: center;
margin-top: 60px;
margin: 0px auto;
width: 100%;
background-color: white;
font-size: 20px;
}
That would be my HTML :
<div id="wrapper">
<div class="navigation">
<table>
<tr>
<th><img src="logo.jpeg"></th>
<th></th>
<th></th>
<th>Startseite</th>
<th>Beats</th>
<th>Preise</th>
<th>Kontakt</th>
</tr>
</table>
</div>
<div class="inhalt">
<p> Some random Text </p>
</div>
</div>
Overall, since you seem to be starting on html and CSS, I would storngly advise you to start with a CSS Framwork like bootstrap, you will be able to easily build from scratch responsive website by relying on predefined classes and module (especially for menu where moving from desktop to tablet to mobile is very painful).
If you were to use Bootstrap 4 here would be a code working on all support :
Insert this between your :
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
Then add this in your code for the navigation and your content
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<a class="navbar-brand" href="#">Navbar</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 mr-auto">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Dropdown
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
</form>
</div>
</nav>
<div class="container">
<div class="row">
<div class="col-md-12">
<p>Some content</p>
</div>
</div>
</div>

<!-- HTML -->
div class="inhalt">
<p> some text </p>
</div>
/*-- CSS-- */
.inhalt{
margin: 10px auto 0;
width: 50%;
}
This is the perfect way of centring the div element.

Related

HTML/CSS/Boostrap5 Website Nav Bar & Positioning Issue

I am troubling in navbar positioning.
My navbar items are disappeared after creating the image below. I have tried to adjust the position of elements but still doesn't work:((
I m also trying to making a fixed-top navbar, it doesn't work too:((
I am bad in positioning, hope someone can show me how to solve the problem.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Nav</title>
<!-- Bootstrap CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap#5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<style>
.carousel-item{
height:32rem;
background:url(https://picsum.photos/200/300);
color:white;
position:relative;
top:0;
}
.container{
position:absolute;
bottom: 0;
left: 0;
right:0;
padding-bottom: 50px;
}
nav{
min-height: 6vh;
background-color: black;
position: fixed;
top: 0;
overflow: hidden;
width: 100%;
}
nav .navbar-nav{
position:relative;
}
nav .navtoggler .navbar-toggler-icon{
background-color: white;
color:lightgray;
margin-left: 0px;
}
nav .logo{
font-size: 2em;
text-decoration: none;
color:white;
font-weight:bolder;
font-family:Arial, Helvetica, sans-serif;
}
nav .collapse a{
font-weight: bold;
font-size: medium;
color:lightgrey;
text-transform: uppercase;
text-decoration: none;
text-align: center;
word-spacing: 1px;
}
nav .collapse a:hover{
color:hotpink;
}
nav .navbar-nav ul{
list-style: none;
}
nav .nav-link{
display:flex;
width:30%;
letter-spacing: 1px;
word-spacing: 10px;
}
nav .btn{
border:1px solid hotpink;
color:white;
}
nav .btn:hover{
color:hotpink;
}
.main{
margin-top: 30px;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-lightdark my-3">
<div class="container ">
<a class="logo " href="index.html" aria-current="page">
<img src="img/logo.png" alt="Logo" style="width:50px; height:55px;"class="d-inline-block mt-2">Fit Fit Fitness
</a>
<button class="navbar-toggler navbar-light bg-light" type="button" data-bs-toggle="collapse" data-bs-target="#navbarToggler" aria-controls="navbarToggler" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarToggler">
<!--Related links to other aspects of the website(only for design purpose, not part of the project) -->
<ul class="navbar-nav ms-auto mb-2">
<li class="nav-item">
<a class="nav-link" href="#fp-section2-thelatest">TheLatest</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#fp-section3-workout">Workout</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Food&Nutrition</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Athlete&Celebrities</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" href="#">Apparel&Gear</a>
</li>
</ul>
<button class="btn btn-small" type="submit">Search</button>
</div>
</div>
</nav>
<main role="main">
<div class="carousel-item active">
<div class="container">
<span class="carousel-artCategory">Food & Nutrition › Weight Loss</span>
<h1 class="carousel-artTitle">Four Easy Change Ups You Can Do Today To Burn More Fat</h1>
<p>
<span class="carousel-artCite">By Train
<time datetime="2017-02-14"> 14 Jul, 2022</time>
</span>
</p>
Read
<a></a>
</div>
</div>
</main>
</body>
</html>
I have tried to insert keyword " fixed-top" into the class of nav, but it doesn't working:((
Besides,
When using position:absolute; the element is removed from the normal document flow, and no space is created for the element in the page layout. It is positioned relative to its closest positioned ancestor, meaning changing it to position:sticky; or removing the line entirely in the container class should fix your issue.

Bootstrap: whitespace on the right side of navbar brand?

I'm using Bootstrap for my navigation bar, and somehow I keep getting whitespace on the right side of the logo image. My navigation code looks like this:
.navbar {
background-color: white;
opacity: 80%;
font-size: 0.8em;
}
.nav-link a {
color: black;
}
.nav-item img {
width: 110px;
margin-top: 8px;
margin-left: 10px;
margin-right: 20px;
}
.nav-item a {
color: black;
}
.navButtons {
background-color: white;
color: black;
padding: 6px;
font-size: 12px;
}
.navButtons:hover {
color: black;
text-decoration: none;
}
<style>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</style>
<nav class="navbar fixed-top navbar-expand-sm navbar-light">
<a class="navbar-brand" href="index.html" style="margin:0;">
<img src="https://via.placeholder.com/468x60?text=Visit+Blogging.com+Now" alt="logo" style="width: 50%;">
</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="navbar-collapse collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item active">
<a class="button navButtons" href="about.html"> Biography <span class="sr-only">(current)</span> </a>
</li>
<li class="nav-item">
<a class="button navButtons" href="interiorDesigns.html"> Interior Design </a>
</li>
<li class="nav-item">
<a class="button navButtons" href="arts.html"> Arts </a>
</li>
<li class="nav-item">
<a class="button navButtons" href="blogs.html"> Blogs </a>
</li>
<li class="nav-item">
<a class="button navButtons" href="contact.html"> Contact </a>
</li>
</ul>
<form class="form-inline my-2 my-lg-0">
<div class="form-group mb-4">
<input type="search" placeholder="Search" class="form-control form-control-underlined">
</div>
</form>
</div>
</nav>
And this is what my logo looks like, the yellow part is where I want to get rid of. I tried changing the padding, margin, and width, but none worked.:
In your Example the Anchor tag is is a block element/parent container of the image.
Apply width and padding-right(if required) to the navbar-brand.
Then instead of adding 50% width make it 100% to the img tag inside.
This will fix your issue.
Example Code (last two lines) in CSS then tag:
.navbar-brand {
display: inline-block;
padding-top: .3125rem;
padding-bottom: .3125rem;
margin-right: 1rem;
font-size: 1.25rem;
line-height: inherit;
white-space: nowrap;
width: 300px;
padding-right: 50px;
}
<img src="https://via.placeholder.com/468x60?text=Visit+Blogging.com+Now" alt="logo" style="width: 100%;">

Cannot collapse bootstrap navbar on specific resolution

I'm trying to collapse the Bootstrap navbar when the screen width is 1280px but instead of getting the navbar collapsed, the Navbar goes on top, this is my code:
body {
padding-top: 90px;
}
#media (min-width: 1280px) {
body {
padding-top: 0;
}
}
#media (min-width: 1280px) {
body {
margin-left: 232px;
}
}
.navbar.fixed-left {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1030;
}
#media (min-width: 1280px) {
.navbar.fixed-left {
bottom: 0;
width: 232px;
flex-flow: column nowrap;
align-items: flex-start;
}
.navbar.fixed-left .navbar-collapse {
flex-grow: 0;
flex-direction: column;
width: 100%;
}
.navbar.fixed-left .navbar-collapse .navbar-nav {
flex-direction: column;
width: 100%;
}
.navbar.fixed-left .navbar-collapse .navbar-nav .nav-item {
width: 100%;
}
.navbar.fixed-left .navbar-collapse .navbar-nav .nav-item .dropdown-menu {
top: 0;
}
}
#media (min-width: 1280px) {
.navbar.fixed-left {
right: auto;
}
.navbar.fixed-left .navbar-nav .nav-item .dropdown-toggle:after {
border-top: 0.3em solid transparent;
border-left: 0.3em solid;
border-bottom: 0.3em solid transparent;
border-right: none;
vertical-align: baseline;
}
.navbar.fixed-left .navbar-nav .nav-item .dropdown-menu {
left: 100%;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet"
id="theme_link"
href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/4.3.1/materia/bootstrap.min.css"/>
<nav class="navbar navbar-expand-md navbar-dark bg-primary fixed-left">
<a class="navbar-brand" href>Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault"
aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link">Home</a>
</li>
<li class="nav-item">
<a class="nav-link">About</a>
</li>
<li class="nav-item">
<a class="nav-link">Contact</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Dropdown</a>
<div class="dropdown-menu">
<a class="dropdown-item">Action</a>
<a class="dropdown-item">Another action</a>
<a class="dropdown-item">Something else here</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item">Separated link</a>
<a class="dropdown-item">One more separated link</a>
</div>
</li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" data-class="fixed-left">
<i class="fa fa-arrow-left"></i>
Fixed Left
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-class="fixed-top">
<i class="fa fa-arrow-up"></i>
Fixed Top
<small>(original)</small>
</a>
</li>
<li class="nav-item">
<a class="nav-link" data-class="fixed-right">
<i class="fa fa-arrow-right"></i>
Fixed Right
</a>
</li>
</ul>
</div>
</nav>
<div class="container">
<div class="jumbotron">
<h1 class="display-4">
Bootstrap Navbar Sidebar
<br>
<small>Fixed to Left or Right</small>
</h1>
<p>
<strong>
Use classic Bootstrap navbar as sidebar, on left or right side.
</strong>
</p>
<p>
<a class="github-button" href="https://github.com/mladenplavsic/bootstrap-navbar-sidebar"
data-icon="octicon-star" data-show-count="true"
aria-label="Star mladenplavsic/bootstrap-navbar-sidebar on GitHub">Star</a>
<a class="github-button" href="https://github.com/mladenplavsic/bootstrap-navbar-sidebar/fork"
data-icon="octicon-repo-forked" data-show-count="true"
aria-label="Fork mladenplavsic/bootstrap-navbar-sidebar on GitHub">Fork</a>
<a class="github-button" href="https://github.com/mladenplavsic"
aria-label="Follow #mladenplavsic on GitHub">Follow #mladenplavsic</a>
</p>
<p>Same as when using <code>.fixed-top</code> for navbar - add class <code>.fixed-left</code> or <code>.fixed-right</code>
where needed.</p>
<p>Click buttons below, and appropriate class will be added to example navbar.</p>
<div class="btn-group" role="group">
<button type="button" data-class="fixed-left" class="btn btn-primary">
<i class="fa fa-arrow-left"></i>
Fixed Left
</button>
<button type="button" data-class="fixed-top" class="btn btn-primary">
<i class="fa fa-arrow-up"></i>
Fixed Top
<small>(original)</small>
</button>
<button type="button" data-class="fixed-right" class="btn btn-primary">
<i class="fa fa-arrow-right"></i>
Fixed Right
</button>
</div>
</div>
<div class="card">
<div class="card-body">
<div class="form-group">
<label>
Select another bootstrap theme from
Bootswatch
</label>
<select class="form-control width-md" id="theme_select" onchange="selectTheme(value)"></select>
</div>
</div>
</div>
</div>
As you can see I setted 1280px in the media queries, but for some reason the navbar instead of collapse, is displayed as topbar, what I did wrong?
Bootstrap's closest breakpoint is at 1200px. I'd recommend sticking to it, because that way you avoid excessive layout changes. If you're willing to move your breakpoints to #media 1200px to match Bootstrap, you can simply change your class .navbar-expand-md to .navbar-expand-xl, and that's it.
Codepen: https://codepen.io/Terrafire123/pen/NWRKdKR
Edit:
If all you want to do is simply prevent the sidebar from overlapping the body, you can add this:
#media (min-width: 1200px) {
body {
margin-left: 232px !important;
}
}
(This already exists in your original code, but without !important, it's getting overwritten to margin:0; by Bootstrap's default settings.)

How to make div 100% with header and fixed footer

I have the problem where I cannot make my content div take up all the space of the content area.
I have a fixed footer and static header. The content div is actually inside the div from a RenderBody directive in ASP.Net Core MVC.
Here are what a couple of pages look like with the footer at the bottom:
So I actually don't mind that the blue content div does not come down to the bottom. I think I can take it or leave it.
But then I created this page with a big image in the content div:
In this last pic you can see the image goes into the footer and extends the height of the footer element from it's orginal 60px height.
Here is my style sheet:
html, body {
height: 100%;
}
.footer{
position: absolute;
bottom: 0;
width: 100%;
white-space:nowrap;
line-height: 60px;
}
.content {
background-color: cornflowerblue /*aliceblue*/;
border: 1px solid black;
padding:10px;
}
.title {
/*background-color: cornflowerblue;*/
}
.center {
display: block;
margin-left: auto;
margin-right: auto;
width: 50%;
}
/* anchor styles */
.nav-link, .dropdown-item {
color: blue !important;
}
.nav-link:hover, .dropdown-item:hover {
color: darkgreen !important;
background-color:aliceblue;
}
.green-header-nav{
color: black;
}
.green-header-nav:hover {
color: black;
}
.facebook-anchor {
color: #4267B2
}
.facebook-anchor:hover {
color: #4267B2
}
/* end anchor styles */
Here is my layout page:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width"
/>
<title>NeuroplasticityTherapies -
#ViewData["Title"]</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/lib/font-awesome/css/fontawesome.min.css" />
<link rel="stylesheet" href="~/lib/Font-Awesome/css/all.min.css">
<link rel="stylesheet" href="~/css/site.css" />
</head>
<body>
<div class="row" style="background-color:black">
<div class="col-3">
<img src="~/Images/dark-blue-brain.jpg" />
</div>
<div class="col-9 text-center">
<div class="text-light" style="height:100%">
<h1>Neuroplasticity Therapies</h1>
<div style="border:1px solid green; padding:15px; border-radius:25px; display:inline-block;">
There are answers and where there are answers there is hope.
</div>
</div>
</div>
</div>
<nav class="navbar navbar-expand-md navbar-light">
#*<a class="navbar-brand" href="#">Navbar</a>*#
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" asp-action="Index">
Neuroplasticity Therapies
</a>
</li>
<li class="nav-item">
<a class="nav-link" asp-action="AboutTheFounder">
About The Founder
</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Functional Neurology
</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<a class="dropdown-item" href="#">Functional Medicine</a>
<a class="dropdown-item" href="#">Neural Plasticity</a>
<a class="dropdown-item" href="#">Alternative Medicine</a>
<a class="dropdown-item" href="#">Integrative Medicine</a>
<a class="dropdown-item" href="#">Holistic Medicine</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Survey</a>
</li>
</ul>
</div>
</nav>
<div class="row bg-info">
<div class="col-sm-3" style="border:2px solid black; text-align:center;font-weight:bold">
Contact Us
</div>
<div class="col-sm-6" style="border:2px solid black; text-align:center;font-weight:bold; background-color:black;">
<a class="facebook-anchor"
href="https://www.facebook.com/groups/NeuroplasticityTherapies/"
target="_blank">
Like Us On Facebook
<i class="fab fa-facebook"></i>
</a>
</div>
<div class="col-sm-3" style="border:2px solid black; text-align:center;font-weight:bold">
<a class="green-header-nav" asp-action="BrainMap">
Brain Map</a>
</div>
</div>
<div class="container-fluid">
#RenderBody()
</div>
<footer id="footer" class="border-top footer text-muted">
<div class="container">
© 2020 - NeuroplasticityTherapies
</div>
</footer>
<script src="~/lib/jquery/jquery.min.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
#*<script>
console.log(`footer.top: ${document.getElementById("footer").offsetTop}`);
var footer_top = document.getElementById("footer").offsetTop;
document.getElementById("content_div").style.bottom
= footer_top;
</script>*#
</body>
</html>
Here is a content page with the blue background for "About The Author":
#{
ViewData["Title"] = "AboutTheFounder";
}
<h1 class="title">About The Founder</h1>
<div id="content_div" class="content">
<b>Gemma Herbertson</b>
<p></p>
Gemma has received training from all different parts of the world to include:
<ul>
<li>Institute of Neuro-Physiological Psychology (UK)</li>
<li>Rhythmic Movement Therapy, JIAS (Denmark)</li>
<li>Family Hope Centre (USA)</li>
<li>Carrick Institute (USA)</li>
<li>Kharrazian Institute (USA)</li>
<li>Gillespie Approach (USA)</li>
<li>The Neuro Science Academy (Australia)</li>
</ul>
Her approach is to work from the <u>bottom-up</u>:
getting the brain to a healthy state
(well-fuelled with nutrients and oxygen),
and then providing individual neuroplasticity exercises
for optimum effect.
</div>
Here is the page with the image on it in the content area. The page is named "BrainMap". This one is raising the issue for me. I believe if there is too much content on any page I will run into this issue.
#{
ViewData["Title"] = "BrainMap";
}
<h1>BrainMap</h1>
<div id="content_div" class="content">
<img src="~/Images/brain_map.jpg" class="center" />
</div>
Don't know why I went down the road of color on the content background but I really want it now I think it is looking good.
You may try using the calc in CSS:
e.g.
if your header height = 100px, and footer = 80px fixed, then you can set your content height = calc(100% - 180px)
Refer: https://www.w3schools.com/cssref/func_calc.asp
html {
height: 100%;
}
body {
position: relative;
margin: 0;
padding-bottom: 60px;
min-height: 100%;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
white-space: nowrap;
line-height: 60px;
}
.content {
background-color: cornflowerblue /*aliceblue*/;
border: 1px solid black;
padding: 10px;
height: calc(100vh - 260px);
/*you can change 260px accordingly to your needs*/
}
...
Here is the result of this demo:

ASP Net Core Angular - Default Project with bootstrap 4 instead of 3 (SideMenu)

I am trying to build a website with Angular6 where there is a vertical navbar when viewed on a large screen and a top navbar with a dropdown on mobile. With Bootstrap 4. I have found multiple examples online but they all seems overly complicated or build without the nav template.
The example project from ASP.Net Core with Angular have a navbar like I want but it is written with Bootstrap3. I have tried to convert it without success and this is where I ask for your help!
Original Code with Bootstrap 3. If you have dotnet core installed, you can use dotnet new angular -o my-new-app to create the project.
HTML
<div class='main-nav'>
<div class='navbar navbar-inverse'>
<div class='navbar-header'>
<button type='button' class='navbar-toggle' data-toggle='collapse' data-target='.navbar-collapse' [attr.aria-expanded]='isExpanded' (click)='toggle()'>
<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' [routerLink]='["/"]'>my_new_app</a>
</div>
<div class='clearfix'></div>
<div class='navbar-collapse collapse' [ngClass]='{ "in": isExpanded }'>
<ul class='nav navbar-nav'>
<li [routerLinkActive]='["link-active"]' [routerLinkActiveOptions]='{ exact: true }'>
<a [routerLink]='["/"]' (click)='collapse()'>
<span class='glyphicon glyphicon-home'></span> Home
</a>
</li>
<li [routerLinkActive]='["link-active"]'>
<a [routerLink]='["/counter"]' (click)='collapse()'>
<span class='glyphicon glyphicon-education'></span> Counter
</a>
</li>
<li [routerLinkActive]='["link-active"]'>
<a [routerLink]='["/fetch-data"]' (click)='collapse()'>
<span class='glyphicon glyphicon-th-list'></span> Fetch data
</a>
</li>
</ul>
</div>
</div>
CSS
li .glyphicon {
margin-right: 10px;
}
/* Highlighting rules for nav menu items */
li.link-active a,
li.link-active a:hover,
li.link-active a:focus {
background-color: #4189C7;
color: white;
}
/* Keep the nav menu independent of scrolling and on top of other items */
.main-nav {
position: fixed;
top: 0;
left: 0;
right: 0;
z-index: 1;
}
#media (min-width: 768px) {
/* On small screens, convert the nav menu to a vertical sidebar */
.main-nav {
height: 100%;
width: calc(25% - 20px);
}
.navbar {
border-radius: 0px;
border-width: 0px;
height: 100%;
}
.navbar-header {
float: none;
}
.navbar-collapse {
border-top: 1px solid #444;
padding: 0px;
}
.navbar ul {
float: none;
}
.navbar li {
float: none;
font-size: 15px;
margin: 6px;
}
.navbar li a {
padding: 10px 16px;
border-radius: 4px;
}
.navbar a {
/* If a menu item's text is too long, truncate it */
width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
}
And here is my attempt to convert it. I used the Bootstrap 4 documentation for the template
<div class="main-nav">
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse" id="navbarNavAltMarkup">
<div class="nav flex-column">
<a class="nav-item nav-link active" href="#">Home</a>
<a class="nav-item nav-link" href="#">Features</a>
<a class="nav-item nav-link" href="#">Pricing</a>
<a class="nav-item nav-link disabled" href="#">Disabled</a>
</div>
</div>
</nav>
</div>
The problem is that the title and the nav are on the same line instead of having then on separate line. How could I achieve that?
(The mobile view doesn't seem to work either, but I haven't tried yet. I am trying to make the desktop view work first)
Looks like I didn't search long enough. I found the solution here: http://www.codingflow.net/building-single-page-applications-on-asp-net-core-2-1-with-angular-6-part-2-upgrading-to-bootstrap-4/
One of the key changes was this in the css
.flex-column {
width: 100%;
}