How can I make this angular8 component fill the whole height? - css

How can I make this angular8 component fill the whole height?
The Root Style.scss has this
html, body, app-root {
min-height: 100vh;
height: auto;
margin: 0;
}
The left green bar (DIV) needs to fill the height of the screen
.nav-left-container {
width: var(--nav-left-w) // 6rem;
height: 100vh;
background-color: var(--col-green-blue);
position: absolute;
top: 0;
left: 0;
}
HTML
<div class="nav-left-container">
<div class="nav-logo-container d-flex justify-content-center align-items-center">
<a [routerLink]="['/home']" routerLinkActive="" (click)=toHome()><img class="nav-logo-img"" alt=" "></a>
</div>
<div class="navigation-container d-flex justify-content-start align-items-center flex-column">
<div class="home d-flex justify-content-center align-items-center mt-4 mb-5">
<a [routerLink]="['/home']" routerLinkActive="" tooltip="Home" placement="right" (click)="toHome()"><img class="nav-link-img" src="../../../assets/images/ui/home.png" alt="home"></a>
</div>
<div class="search d-flex justify-content-center align-items-center mb-5">
<a [routerLink]="['/products']" routerLinkActive="" tooltip="Search" placement="right" (click)="toSearch()"><img class="nav-link-img" src="../../../assets/images/ui/barcode_search.png" alt="search"></a>
</div>
<div class="history d-flex justify-content-center align-items-center mb-5">
<a [routerLink]="['/history']" routerLinkActive="" tooltip="History" placement="right" (click)="toHistory()"><img class="nav-link-img" src="../../../assets/images/ui/history.png" alt="history"></a>
</div>
<div class="settingsd-flex justify-content-center align-items-center mb-5">
<a [routerLink]="['/settings']" routerLinkActive="" tooltip="Settings" placement="right" (click)="toSettings()"><img class="nav-link-img" src="../../../assets/images/ui/settings.png" alt="settings"></a>
</div>
</div>
</div>
The main container of the page (home and notifications (grey) have this
.home-container {
width: calc(100% - var(--nav-left-w)) // to avoid horizontal scroll;
height: 100vh;
margin-left: 6rem;
}
HTML
.home-container {
width: calc(100% - var(--nav-left-w));
height: 100vh;
margin-left: 6rem;
}
<app-nav-top></app-nav-top>
<div class="container-fluid home-container">
<div class="row">
<div class="col-md-9">
<div class="row mt-4">
<div class="col">
<div class="find-resource-wrapper mt-4">
<a (click)="onFindResource()">
<h1>Find a resource <fa-icon [icon]="faSearchPlus"></fa-icon>
</h1>
</a>
<hr>
<div class="find-resource-display-wrapper">
<app-resource-list></app-resource-list>
</div>
</div>
</div>
</div>
<!-- end find resource -->
<div class="row mt-4">
<div class="col">
<div class="offer-resource-wrapper">
<a>
<h1>Offer resource <fa-icon [icon]="faSearchPlus"></fa-icon>
</h1>
</a>
<hr>
</div>
</div>
</div>
<!-- end offer resource -->
<div class="row mt-4">
<div class="col">
<div class="cycles-wrapper">
<a>
<h1>Cycles <fa-icon [icon]="faRecycle"></fa-icon></h1>
</a>
<hr>
</div>
</div>
</div>
<!-- end cycles -->
</div>
<!-- end main left -->
<div class="col-md-3 notification-area">
<div class="row">
<div class="col">
<div class="mt-4">Logged in as</div>
<div>
<fa-icon [icon]="faEnvelope"></fa-icon> {{email}}
</div>
</div>
</div>
</div>
</div>
<!-- end notification -->
</div>
<!-- end home-container -->
<app-nav-left></app-nav-left>
How can I get the green bar to fill the whole height of the screen?
Thank you in advance.

try to make change in your css I am sure it will work.
.nav-left-container {
width: var(--nav-left-w) // 6rem;
background-color: var(--col-green-blue);
position: absolute;
top: 0;
left: 0;
bottom: 0;
}

Related

CSS flip card with bootstrap 4

I am using an amalgamation of the various posts here and the w3c tutorial on making flip cards work with bootstrap 4.
I have it working execpt for the back face is not the same height as the front face. (I have yet to add meaningful text to the back) I am sure I am missing something like adding a H-100 somewhere but can't seem to get to where I am going wrong.
Could any of you see any issues in my code?
<a href="" class="">
<div class="card-flip">
<div class="card-flip-inner">
<div class="card-flip-front">
<div class="card shadow-sm">
<div class="card-body">
<div class="row">
<div class="col text-center">
<i class="fas fa-route fa-3x text-msp-orange"></i>
</div>
<div class="col-10 text-right">
<h3 class="text-msp-darkblue text-uppercase mb-0"><b><?php echo $log->post_title; ?></b></h3>
<p class="text-secondary mt-0">
<?php echo $log->post_description; ?>
</p>
</div>
</div>
<hr />
<div class="row">
<div class="col">
<p class="text-secondary text-justify mb-0 pb-0">
<?php echo shortenEcho($log->post_body, 250); ?>
</p>
<span class="text-secondary float-right mt-0 pt-0"><?php echo date('D jS F Y', strtotime($log->post_createdOn)); ?></span>
</div>
</div>
</div>
<div class="card-footer">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-4 col-xl-4 text-center text-secondary card-vertical-divider">
<i class="fas fa-wind fa-2x text-msp-lightblue"></i><br />
<b>Force 4</b>
</div>
<div class="col-sm-12 col-md-12 col-lg-4 col-xl-4 text-center text-secondary card-vertical-divider">
<i class="fas fa-water fa-2x text-msp-lightblue"></i><br />
<b>Moderate</b>
</div>
<div class="col-sm-12 col-md-12 col-lg-4 col-xl-4 text-secondary text-center">
<i class="fas fa-cloud-sun fa-2x text-msp-lightblue"></i><br />
<b>Sunny</b>
</div>
</div>
</div>
</div>
</div>
<div class="card-flip-back h-100">
<div class="card shadow-sm bg-msp-lightblue">
<div class="card-body text-white h-100">
some text
</div>
</div>
</div>
</div>
</div>
</a>
And my CSS is...
.card-flip {
perspective: 1000px;
}
.card-flip-inner {
position: relative;
width: 100%;
height: 100%;
transition: transform 0.8s;
transform-style: preserve-3d;
backface-visibility: hidden;
}
/* Do an horizontal flip when you move the mouse over the flip box container */
.card-flip:hover .card-flip-inner {
transform: rotateY(180deg);
}
/* Position the front and back side */
.card-flip-front, .card-flip-back {
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden; /* Safari */
backface-visibility: hidden;
}
/* Style the back side */
.card-flip-back {
transform: rotateY(180deg);
position: absolute;
top: 0;
left: 0;
}
UPDATE: I think I have found the answer...
I have added a H-100 to the <div class="card h-100 shadow-sm">
And also to the...
<div class="card-flip-back">
<div class="card shadow-sm h-100 bg-msp-lightblue">
<div class="card-body mx-auto text-white h-100">
some text
</div>
</div>
Just need to center the text in the card vertically now and we are all good :-)
CSS flip card with bootstrap 4
.flip-card {
width: 300px;
height: 300px;
perspective: 1000px;
transition: 0.3s;
}
.flip-card-inner {
position: relative;
width: 100%;
height: 100%;
text-align: center;
transition: transform 0.6s;
transform-style: preserve-3d;
box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
}
.flip-card:hover .flip-card-inner {
transform: rotateY(180deg);
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
}
.flip-card-front, .flip-card-back {
position: absolute;
width: 100%;
height: 100%;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.flip-card-back {
transform: rotateY(180deg);
}
<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">
<div class="flip-card">
<div class="flip-card-inner">
<div class="flip-card-front">
<div class="card shadow-sm">
<div class="card-flip-front">
<div class="card shadow-sm">
<div class="card-body">
<div class="row">
<div class="col text-center">
<i class="fas fa-route fa-3x text-msp-orange"></i>
</div><!-- end col-->
<div class="col-10 text-right">
<h3 class="text-msp-darkblue text-uppercase mb-0"><b></b></h3>
<p class="text-secondary mt-0"> </p>
</div><!-- end col-10-->
</div><!-- end row -->
<hr />
<div class="row">
<div class="col">
<p class="text-secondary text-justify mb-0 pb-0"> </p>
<span class="text-secondary float-right mt-0 pt-0"></span>
</div><!-- end col-->
</div><!-- end row -->
</div><!-- end card body -->
<div class="card-footer">
<div class="row">
<div class="col-sm-12 col-md-12 col-lg-4 col-xl-4 text-center text-secondary card-vertical-divider">
<i class="fas fa-wind fa-2x text-msp-lightblue"></i><br />
<b>Force 4</b>
</div><!-- end col-sm-12 col-md-12 col-lg-4 col-xl-4-->
<div class="col-sm-12 col-md-12 col-lg-4 col-xl-4 text-center text-secondary card-vertical-divider">
<i class="fas fa-water fa-2x text-msp-lightblue"></i><br />
<b>Moderate</b>
</div><!-- end col-sm-12 col-md-12 col-lg-4 col-xl-4-->
<div class="col-sm-12 col-md-12 col-lg-4 col-xl-4 text-secondary text-center">
<i class="fas fa-cloud-sun fa-2x text-msp-lightblue"></i><br />
<b>Sunny</b>
</div><!-- end col-sm-12 col-md-12 col-lg-4 col-xl-4-->
</div><!-- end row -->
</div><!-- end card footer -->
</div><!-- end card -->
</div><!-- end card flip front -->
</div><!-- end card -->
</div><!-- end card flip front -->
<div class="flip-card-back">
<div class="card shadow-sm ">
<div class="card-body text-dark h-100">
some text
</div><!-- end card body -->
</div><!-- end card -->
</div><!-- end card flip back -->
</div><!-- end card flip inner -->
</div><!-- end card flip -->

How to adjust margins creating a Dashboard with css and Bootstrap

I am creating an admin Dashboard with Bootstrap but I can't get the margins of the sidebar and the main panel to work correctly. Is hardcoding the margins in a .css file the way this is normally done? For example, once I have the top bar, should I use margin-top for the sidebar on the left with the value of the top-bar height?
The reason I'm asking is that if I margin-top the main panel with the same value, which is reasonable, the sidebar is also dropping even more. Also, I'm not sure how to set the margin on the left of the main panel. Styling is driving crazy.
Here's a picture of what I just said.
.sidebar {
position: absolute;
height: 100%;
margin-top: 55.6px;
}
.options-container {
margin-top: 56px;
margin-left: 780px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-beta.2/css/bootstrap.css" rel="stylesheet" />
<main role="main" class="container container-fluid options-container bg-light">
<div class="row">
<div class="option col-sm-3">
<div class="card card-block bg-light">
<h4>Add Player</h4>
</div>
</div>
<div class="option col-sm-3">
<div class="card card-block bg-secondary">
<h4>Add Team</h4>
</div>
</div>
<div class="option col-sm-3">
<div class="card card-block bg-warning">
<h4>Add Competition</h4>
</div>
</div>
<div class="option col-sm-3">
<div class="card card-block bg-danger">
<h4>Add Referee</h4>
</div>
</div>
<div class="option col-sm-3">
<div class="card card-block bg-info">
<h4>Add Stadium</h4>
</div>
</div>
</div>
</main>
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
<div class="list-group">
<h5 class="players-title">Players</h5>
<label class="player-item" *ngFor="let player of players" (click)="onSelect(player)">
<span class="badge">{{player.id}}</span> {{player.name}}
<app-player-detail [player]="selectedPlayer"></app-player-detail>
</label>
</div>
</nav>
Ok so you have a lot of work to do to rebuild this as there's a few issues, you didn't give me all your styling so I made my own:
* {
padding: 0px;
margin: 0px;
}
.sidebar {
height:100vh;
display:inline-block;
float:left;
background: green;
padding: 20px;
margin-right: 20px;
width: 20%;
}
.options-container {
width: 72%;
display:inline-block;
margin-top: 20px;
}
.option {
display: inline-block;
margin-right: 10px;
}
.card {
background: yellow;
padding: 10px 20px;
border-radius: 20px;
}
.card h4 {
line-height: 20px;
font-size: 16px;
margin: 0px;
}
<div class="container">
<main role="main" class="container container-fluid options-container bg-light">
<div class="row">
<div class="option col-sm-3">
<div class="card card-block bg-light">
<h4>Add Player</h4>
</div>
</div>
<div class="option col-sm-3">
<div class="card card-block bg-secondary">
<h4>Add Team</h4>
</div>
</div>
<div class="option col-sm-3">
<div class="card card-block bg-warning">
<h4>Add Competition</h4>
</div>
</div>
<div class="option col-sm-3">
<div class="card card-block bg-danger">
<h4>Add Referee</h4>
</div>
</div>
<div class="option col-sm-3">
<div class="card card-block bg-info">
<h4>Add Stadium</h4>
</div>
</div>
</div>
</main>
<nav class="col-md-2 d-none d-md-block bg-light sidebar">
<div class="list-group">
<h5 class="players-title">Players</h5>
<label class="player-item" *ngFor="let player of players" click)="onSelect(player)">
<span class="badge">{{player.id}}</span> {{player.name}}
<app-player-detail [player]="selectedPlayer"></app-player-detail>
</label>
</div>
</nav>
</div>
Here's a working codepen: https://codepen.io/danielvickerssa/pen/rvWvaO
By all means this isn't perfect like you should use flexbox for sizing etc. however this solves the issue you had.

Bootstrap 4 vertical align

I'm trying to center the content, vertical and horizontal. I'm having some problems with the vertical part: Working Plunker
My custom css card:
.customCard {
width: 15rem;
height: 7rem;
background-color: blue;
color:#eee;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/>
<div class="card-deck">
<div class="card-block ">
<div class="card customCard mt-2 customCursorPointer">
<div class="card-body">
<div class="container d-flex r h-100">
<div class="row justify-content-center mx-auto align-items-center">
<h4 class="card-title">AAAA</h4>
</div>
</div>
</div>
</div>
</div>
</div>
You need to add height:100% in .card-body
.customCard {
width: 15rem;
height: 7rem;
background-color: blue;
color:#eee;
}
.card-body {
height: 100%;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" rel="stylesheet"/>
<div class="card-deck">
<div class="card-block ">
<div class="card customCard mt-2 customCursorPointer">
<div class="card-body">
<div class="container d-flex r h-100">
<div class="row justify-content-center mx-auto align-items-center">
<h4 class="card-title">AAAA</h4>
</div>
</div>
</div>
</div>
</div>
</div>

Panel footer, background for the entire section

I have a bootstrap panel where the height is automatically generated from a jquery script.
So, I would like to have the footer with a background for the entire section.
How can I achieve this goal ?
I don't want to fix the height for this section, is it possible to make something like :"height for the rest of your space in the panel".
Here the fiddle:
http://www.bootply.com/XBCffrO0My
Table layout approach
Idea is to have the element behave like a table and the child item as its row which would occupy the entire space.
Updated Bootply
#crud1 {
display: table;
width: 100%;
}
.panel-footer {
display: table-row;
height: 100%;
}
.panel-footer .row {
display: table-cell;
padding-top: 5px;
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="col-md-4">
<div id="crud1" class="panel panel-primary" style="height: 248px;">
<div class="panel-heading clearfix">
<div class="pull-left">
ChartLine 1
</div>
<div class="pull-right">
<span class="label label-success">priusa2</span>
</div>
<div class="pull-right" style="padding-right: 7px;">
<span class="label label-success status"></span>
</div>
<p></p>
</div>
<!-- panel-heading closed -->
<div class="panel-body">
<div class="container-fluidrm">
No-picture
</div>
</div>
<!-- panel-body closed -->
<div class="panel-footer">
<div class="row" style="height: 100%;">
<div class="col-md-9">
<p>Description:</p>
</div>
<div class="col-md-1">
<a class="show-popup" href="#" id="poplink" data-showpopup="ChartLine 1"><span id="logos" class="material-icons"></span></a>
</div>
<div class="col-md-1" style="margin-left:7px;">
<span id="logos" class="glyphicon glyphicon-star"></span>
</div>
</div>
</div>
<!-- panel-footer closed -->
</div>
</div>
Flexible box approach
Give the child item flex: 1 to expand with the parent element.
Updated Bootply
#crud1 {
display: flex; /* Activate flexbox module layout */
flex-direction: column; /* Align items horizontally */
}
.panel-footer {
flex: 1; /* Expand with the parent */
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<div class="col-md-4">
<div id="crud1" class="panel panel-primary" style="height: 248px;">
<div class="panel-heading clearfix">
<div class="pull-left">
ChartLine 1
</div>
<div class="pull-right">
<span class="label label-success">priusa2</span>
</div>
<div class="pull-right" style="padding-right: 7px;">
<span class="label label-success status"></span>
</div>
<p></p>
</div>
<!-- panel-heading closed -->
<div class="panel-body">
<div class="container-fluidrm">
No-picture
</div>
</div>
<!-- panel-body closed -->
<div class="panel-footer">
<div class="row" style="height: 100%;">
<div class="col-md-9">
<p>Description:</p>
</div>
<div class="col-md-1">
<a class="show-popup" href="#" id="poplink" data-showpopup="ChartLine 1"><span id="logos" class="material-icons"></span></a>
</div>
<div class="col-md-1" style="margin-left:7px;">
<span id="logos" class="glyphicon glyphicon-star"></span>
</div>
</div>
</div>
<!-- panel-footer closed -->
</div>
</div>

center row content in bootstrap grid

I know this question has been asked a lot but each one seems to be a bit unique and I have tried at least 7 different versions here on StackOverflow and none have worked.
It should be a simple fix but I can't center the div contents. I need all the rows centered to the gird and centered when scaled all the way down to the mobile view.
Here is my code example:
http://codepen.io/anon/pen/aOBJEv
Here is the html:
<div class="row-fluid">
<div class="bottom col-xs-12 col-sm-12 col-md-6 col-lg-6"><img src="http://edvizenor.com/2015/wordpress/wp-content/uploads/2015/05/image-333x333.jpg" class="img-btm">
<div class="top"> <img src="http://www.edvizenor.com/2015/images/TopicCircleBlue.png"> </div>
<div class="topic text-center">cheese </div>
</div>
<div class="bottom col-xs-12 col-sm-12 col-md-6 col-lg-6"><img src="http://edvizenor.com/2015/wordpress/wp-content/uploads/2015/05/Ed-Vizenor-150x150.jpg" class="img-btm">
<div class="top"> <img src="http://www.edvizenor.com/2015/images/TopicCircleBlue.png"> </div>
<div class="topic text-center">Cool Beans </div>
</div>
<div class="bottom col-xs-12 col-sm-12 col-md-6 col-lg-6"><img src="http://edvizenor.com/2015/wordpress/wp-content/uploads/2015/05/BeauBird-150x150.png" class="img-btm">
<div class="top"> <img src="http://www.edvizenor.com/2015/images/TopicCircleBlue.png"> </div>
<div class="topic text-center">I am happy </div>
</div>
<div class="bottom col-xs-12 col-sm-12 col-md-6 col-lg-6"><img src="http://edvizenor.com/2015/wordpress/wp-content/uploads/2015/05/ave4-150x150.jpg" class="img-btm">
<div class="top"> <img src="http://www.edvizenor.com/2015/images/TopicCircleBlue.png"> </div>
<div class="topic text-center">Hello world! </div>
</div>
</div>
I have added the .row-fluid{...} and div.bottom{...} code blocks to your existing CSS.
.row-fluid {
text-align: center;
}
div.bottom {
display: inline-block;
float: none;
text-align: left;
}
.top {
position: absolute;
top: -5px;
left: 0px;
}
.topic {} .bottom {
position: relative;
top: 0px;
left: 0px;
margin-bottom: 25px;
max-width: 275px;
min-width: 277px;
}
.img-btm {
height: 233px;
width: 228px;
-webkit-border-radius: 233px;
-moz-border-radius: 233px;
border-radius: 233px;
}
.bottom .text-center {
max-width: 275px;
min-width: 277px;
position: absolute;
left: -10px;
top: 18px;
font-size: 18px;
color: white;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" />
<div class="row-fluid">
<div class="bottom col-xs-12 col-sm-12 col-md-6 col-lg-6">
<img src="http://edvizenor.com/2015/wordpress/wp-content/uploads/2015/05/image-333x333.jpg" class="img-btm">
<div class="top">
<img src="http://www.edvizenor.com/2015/images/TopicCircleBlue.png">
</div>
<div class="topic text-center">cheese</div>
</div>
<div class="bottom col-xs-12 col-sm-12 col-md-6 col-lg-6">
<img src="http://edvizenor.com/2015/wordpress/wp-content/uploads/2015/05/Ed-Vizenor-150x150.jpg" class="img-btm">
<div class="top">
<img src="http://www.edvizenor.com/2015/images/TopicCircleBlue.png">
</div>
<div class="topic text-center">Cool Beans</div>
</div>
<div class="bottom col-xs-12 col-sm-12 col-md-6 col-lg-6">
<img src="http://edvizenor.com/2015/wordpress/wp-content/uploads/2015/05/BeauBird-150x150.png" class="img-btm">
<div class="top">
<img src="http://www.edvizenor.com/2015/images/TopicCircleBlue.png">
</div>
<div class="topic text-center">I am happy</div>
</div>
<div class="bottom col-xs-12 col-sm-12 col-md-6 col-lg-6">
<img src="http://edvizenor.com/2015/wordpress/wp-content/uploads/2015/05/ave4-150x150.jpg" class="img-btm">
<div class="top">
<img src="http://www.edvizenor.com/2015/images/TopicCircleBlue.png">
</div>
<div class="topic text-center">Hello world!</div>
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
source: Bootstrap 3 responsive centered columns
Source has no explanation for the code, so
The class .row-fluid has a text-align:center property which makes its contents centered.
Under div.bottom I have the display:inline-block property which is necessary for its parents text-align property to work; float:none overrides the default float:left and text-align:left is a fix for center positioning the image inside the column div, because there was some padding to the element.

Resources