I have a template that mix bootstrap accordion and dropdown, the problem is that dropdown appears behind the next question card or what is the same, inside your card and is not seen.
template.html:
<div class="card-body">
<!-- Acordion -->
<div class="accordion" id="dlns_faqs_acordion">
{% for element in elements %}
<div class="card">
<div class="card-header dlns_faqs_acordion_heading" id="dlns_faqs_acordion_heading_{{ forloop.counter0 }}">
<h2 class="mb-0">
<button class="btn btn-link btn-block text-left collapsed" type="button" data-toggle="collapse" data-target="#dlns_faqs_acordion_content_{{ forloop.counter0 }}" aria-expanded="false" aria-controls="dlns_faqs_acordion_content_{{ forloop.counter0 }}">
{{ element.question }}
</button>
</h2>
<!-- Options -->
<div class="dropdown">
<button class="btn dlns_elements_button" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="fas fa-ellipsis-h"></span>
</button>
<div class="dropdown-menu dropdown-menu-right text-center" arial-labelledby="option_button">
...
<a>...</a>
...
</div>
</div>
</div>
<div id="dlns_faqs_acordion_content_{{ forloop.counter0 }}" class="dlns_faqs_acordion_content collapse" aria-labelledby="dlns_faqs_acordion_heading_{{ forloop.counter0 }}" data-parent="#dlns_faqs_acordion">
<div class="card-body">
{{ element.answer }}
</div>
</div>
</div>
{% endfor %}
</div>
</div>
style.css:
.dlns_faqs_acordion {
border: none;
}
.dlns_faqs_acordion_heading {
border: none;
background: transparent;
display: flex;
flex-wrap: nowrap;
justify-content: flex-start;
align-items: center;
flex-direction: row;
align-content: space-between;
}
.dlns_faqs_acordion_heading button {
color: var(--dlns_color_primary) !important;
}
.dlns_faqs_acordion_heading button.collapsed {
color: black !important;
}
.dlns_faqs_acordion_heading button:hover {
text-decoration: none;
}
.dlns_faqs_acordion_content {
color: var(--dlns_color_tertiary);
}
Here there are some images with the problem:
And the Fiddle:
https://jsfiddle.net/albertosanmartinmartinez/o287rysk/12/
Anybody cloud help me ?
Thanks in advance.
Since you did not create a fiddle or plnkr, i can only provide some suggestions:
Manually adjust the dropdown-menu box z-index to a very big value to see if it works.
Check the container who cut the dropdown-menu, to ensure the overflow property is set to visible.
Update:
.card {
overflow: visible;
}
https://jsfiddle.net/65fq347r/
Related
I am new to angular and flex layout. My Page is pretty simple. Header with side navbar and router outlet.
I ran into the issue that my Page always shows a scrollbar.
If I remove fxFlexFill, scrollbar not showing. How can I fix this?
Here is stackblitz demo Stackblitz
Here is my template:
.fill-space {
flex: 1 1 auto;
}
.content {
flex: 1 1 auto;
padding: 15px;
position: relative;
overflow-y: auto;
}
.footer {
display: flex;
flex: 1 0 auto;
justify-content: center;
}
<div style="height: 100vh;">
<mat-toolbar color="primary" class="fixed-header">
<mat-toolbar-row>
<button mat-icon-button (click)="sidenav.toggle()" fxShow="true" fxHide.gt-sm>
<mat-icon>menu</mat-icon>
</button>
<span><button mat-button routerLink="/home"><h3>HOSPITALITY</h3></button></span>
<span class="fill-space"></span>
<div fxShow="true" fxHide.lt-md="true">
<button mat-button routerLink="/home">HOME</button>
<button mat-button routerLink="/account">MY ACCOUNT</button>
<button mat-button routerLink="/login">LOGOUT</button>
<a href="#" routerLink="/cart" mat-button>
<mat-icon>shopping_cart</mat-icon>
0
</a>
</div>
</mat-toolbar-row>
</mat-toolbar>
<mat-sidenav-container fxFlexFill>
<mat-sidenav #sidenav fxLayout="column" mode="over" opened="false" fxHide.gt-sm="true">
<div fxLayout="column">
<button mat-button routerLink="/home">HOME</button>
<button mat-button routerLink="/account">MY ACCOUNT</button>
<button mat-button routerLink="/login">LOGOUT</button>
<a href="#" routerLink="/cart" mat-button>
<mat-icon>shopping_cart</mat-icon>
0
</a>
<a (click)="sidenav.toggle()" mat-list-item>
<mat-icon>close</mat-icon> Close
</a>
</div>
</mat-sidenav>
<mat-sidenav-content >
<div class="content">
<router-outlet></router-outlet>
</div>
</mat-sidenav-content>
</mat-sidenav-container>
</div>
The main issue is that the side nav gets a height of 100vh via the fxFlexFill directive.
You need to take into account the height of mat-toolbar-row, for example, by CSS calc (there are other ways to achieve his effect, depends on how you struct page layout)
Additionally, the body has an 8px margin, from the browser default style.
Here is a fork of Stackblitz
I have some buttons on a row, two aligned on the left and one aligned on the right as follows:
html {
position: relative;
min-height: 100%;
}
body {
/* Margin bottom by footer height */
margin-bottom: 60px;
}
.footer {
position: absolute;
bottom: 0;
width: 100%;
/* Set the fixed height of the footer here */
height: 60px;
/* Vertically center the text there */
line-height: 60px;
background-color: #f5f5f5;
}
.fa-arrows-alt {
color: rgb(231, 81, 37);
cursor: pointer;
}
<script src="https://use.fontawesome.com/23ac9aaa92.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid">
<div class="row">
<div class="col-12 col-md-12">
A div here
</div>
<div class="col-12 col-md-12">
<button type="button" class="btn btn-outline-dark btn-sm">Edit</button>
<button type="button" class="btn btn-outline-dark btn-sm">Delete</button>
<i class="fa fa-arrows-alt fa-2x float-right"></i>
</div>
</div>
</div>
<footer class="footer">
<div class="container">
<span class="text-muted">Place sticky footer content here.</span>
</div>
</footer>
I would like the buttons to force them to be always on the bottom of the div, above the footer. I tried using bottom: 0 and position absolute, fixed but I received an unexpected result. Any suggestions are welcome.
use bootstrap 4 position-absolute predefined class and add bottom:0
.position-absolute {
bottom: 0;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet" />
<div class="container-fluid position-absolute">
<div class="row">
<div class="col-12 col-md-12 btn-row">
<button type="button" class="btn btn-outline-dark btn-sm">Edit</button>
<button type="button" class="btn btn-outline-dark btn-sm">Delete</button>
<button type="button" class="btn btn-outline-dark btn-sm float-right">Full Screen</button>
</div>
</div>
</div>
Use the flexbox classes that are built in to Bootstrap. You just need CSS to make sure the body is display:flex and full height...
https://www.codeply.com/go/lEaF85K1KU
CSS
body {
height:100vh;
display: flex;
flex-direction: column;
}
.flex-fill {
flex: 1 1 auto;
}
HTML
<main class="container-fluid d-flex flex-column flex-fill">
<div class="row flex-column flex-fill">
<div class="col-12 flex-fill">
A div here
</div>
<div class="col-12">
<button type="button" class="btn btn-outline-dark btn-sm">Edit</button>
<button type="button" class="btn btn-outline-dark btn-sm">Delete</button>
<i class="fa fa-arrows-alt fa-2x float-right"></i>
</div>
</div>
</main>
<footer class="container-fluid bg-light py-3">
Sticky Footer
</footer>
Note: The flex-fill utility class will be included in the next Bootstrap 4.1 release. So after that release the extra CSS for flex-fill won't be needed.
To get something to stick to the bottom of the screen, do
<footer class="fixed-bottom">
To get buttons to go left and right give each button a class of “pull-left” or “pull-right”
How can I align heading and button in same line? The button should be on the right side of the page, and the heading should be on the left side of the page.
Html:
<mat-card>
<h1>Simple card</h1>
<button mat-icon-button>
<mat-icon aria-label="Example icon-button with a heart icon">favorite</mat-icon>
</button>
<button mat-fab>Basic</button>
</mat-card>
Demo
You can use the position:absolute by adding this HTML/CSS code
HTML
<mat-card>
<h1>Simple card</h1>
<div class="buttons">
<button mat-icon-button>
<mat-icon aria-label="Example icon-button with a heart icon">favorite</mat-icon>
</button>
<button mat-fab>Basic</button>
</div>
</mat-card>
CSS
.mat-card{ position: relative }
h1{ margin-right: 120px; }
.buttons{
position: absolute;
top:50%;
right: 0;
width: 120px;
transform: translateY(-50%);
}
Using flexbox will align buttons and text as vertically center too.
Guide for flexbox
HTML
<mat-card>
<h1>Simple card</h1>
<div class="buttons">
<button mat-icon-button>
<mat-icon aria-label="Example icon-button with a heart icon">favorite</mat-icon>
</button>
<button mat-fab>Basic</button>
</div>
</mat-card>
CSS
h1 {
margin: 0;
}
.mat-card {
display: flex;
align-items: center;
justify-content: space-between;
}
Demo
This is my css and HTML template file.
#wrapper {
display: inline!important;
height: 275px;
max-width: 540px;
}
.box {
margin: 5px;
display: inline-block;
width: 170px;
height: 275px!important;
background-color: #F5FBEF;
text-align: center;
float: left;
}
.ng-repeat {
display: inline-block;
}
HTML File
<br>
<div>
<div ng-if="SearchText.length<3" ng-repeat="product in pc.ProductService.Products | filter:FilterExpr:true |orderBy:['SubCategoryName','BrandName'] | groupBy:['BrandName']" >
<div ng-show="product.group_by_CHANGED"><h2>{{product.BrandName}} </h2></div>
<div id=wrapper>
<div class='box'>
<ng-include src="'commonTemplate.html'"></ng-include>
</div>
</div>
</div>
<!-- template (common piece of code) -->
<script type="text/ng-template" id="commonTemplate.html">
<div class="BrandName"> <b>{{product.BrandName}}</b> </div>
<div class="ProductName"> {{product.ProductName}} </div>
<br>
<div> <img src="http://localhost/{{ product.ProductImagePath }}" alt="" border=3 height=75 width=75></img> </div>
<div class="ProductVariants">
<select class="form-control btn btn-default btn-xs text-center" ng-init="SelectedVariant = product.Variants[0]" ng-model="SelectedVariant" ng-options="variant.VariantName for variant in product.Variants" ng-change="ChangeVariant(product.ProductID, SelectedVariant.VariantID)"></select>
</div>
<div class="Price">
<strike> {{SelectedVariant.MRP}} </strike> {{SelectedVariant.SellPrice}}
</div>
<div class="AddToCart" ng-if="SelectedVariant.InCart==0">
<a class="btn btn-success btn-sm" ng-click="pc.AddToCart(product.ProductID, SelectedVariant.VariantID)">Add to Cart
<span class="glyphicon glyphicon-plus"></span>
</a>
</div>
<div class="AddToCart" ng-if="SelectedVariant.InCart>0">
<a class="btn btn-default btn-xs" ng-click="pc.PlusItem(product.ProductID, SelectedVariant.VariantID)">
<span class="glyphicon glyphicon-plus"></span>
</a>
<button type="button" class="btn btn-sm btn-info disabled">{{SelectedVariant.InCart}} in cart</button>
<a class="btn btn-default btn-xs" ng-click="pc.MinusItem(product.ProductID, SelectedVariant.VariantID)">
<span class="glyphicon glyphicon-minus"></span>
</a>
</div>
</script>
</div>
This is how my page looks like-
What i want when new brand comes say annapurna or panchratan, display that in new line. and then in next line display all the products of that brand.
(similar to aashirvad first brand.)
How to do that?
You have to wrap whole template with outer div that is full width:
<script type="text/ng-template" id="commonTemplate.html">
<div class="brand-wrapper">
<div class="BrandName"> <b>{{product.BrandName}}</b> </div>
...
</div>
</script>
// May be omitted as div already block element.
.brand-wrapper {
clear: both; // if floated
width: 100%;
display: block;
}
Change wrapper:inline to inline-block and it should work. Also put your h2 inside the wrapper.
Also, change the float on the box to float:right;
I want to show the glyphs as in example A for desktop monitors and as in example B for mobile when the menu is extended. (The code is the same in both examples, except for the css).
Example A: http://jsfiddle.net/bs773m84/4/
<div class="container">
<nav class="header-nav-wrapper container-nav-menu navbar navbar-default white-back">
<div class="container-fluid">
<div class="navbar-header">
<a alt="" rel="home" href="google.com">
<img class="logo" src="http://icons.iconarchive.com/icons/cornmanthe3rd/plex-android/48/app-drawer-icon.png"/>
</a>
<button data-target="#social-menu" data-toggle="collapse" class="navbar-toggle collapsed" type="button">
<span class="sr-only"><?php _e('Toggle navigation menu','justmakeit');?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
</div>
<div class="col-sm-11 content">
<div class="container-fluid">
<div class="hidden-xs col-sm-6 blue-light-back"><span>Brand</span>
</div>
<div class="col-xs-12 col-sm-4 col-sm-push-4 col-md-push-4 red-dark-back">
<div id="social-menu" class="collapse navbar-collapse">
<ul class="menu nav navbar-nav navbar-default white-back">
<li class="facebook">
<a href="http://facebook.com" target="_blank">
<span class="glyphicon glyphicon-play-circle"></span><span class="social-name">facebook</span>
</a>
</li>
<li class="twitter">
<a href="http://twitter.com" target="_blank">
<span class="glyphicon glyphicon-download"></span><span class="social-name">twitter</span>
</a>
</li>
<li class="google-plus">
<a href="http://plus.google.com" target="_blank">
<span class="glyphicon glyphicon-download"></span><span class="social-name">google+</span>
</a>
</li>
<li class="pinterest">
<a href="http://pinterest.com" target="_blank">
<span class="glyphicon glyphicon-download"></span><span class="social-name">pinterest</span>
</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</nav>
</div>
Example A css:
#social-menu li{
display: inline-block;
padding: 0px;
}
#social-menu li a{
padding: 0px;
}
#social-menu .social-name{
display: block;
height: 1.4375em;
overflow: hidden;
text-indent: 100%;
transition: all 0.3s ease 0s;
white-space: nowrap;
width: 1.4375em;
}
Example B: http://jsfiddle.net/77m94xf4/4/
Html is the same as in Example A.
Example B css: No.
To do this you can use #media Query and set your css attribute for each size.
for Example :
#media screen and (max-width: 300px)
{
add your css for mobile
}
#media screen and (min-width: 800px)
{
add your css for desctop
}
by #media Query you can set css for each devices. eg:mobile,tablet,desktop.
Learn more about #media query
I added #media Query to revert CSS of the menu items for mobile.
#media screen and (min-width: 1px) and (max-width: 767px){
#social-menu li{
display:block
}
#social-menu .social-name{
display: inline;
height: none;
overflow: none;
text-indent: none;
white-space: none;
width: none;
}
}