How to center the mat-chips in a stacked mat-chip-list - angular-material

This is how the chips are stacked right now:
The space on the left is clearly less then on the right. How can i center the chips so that the margins on both sides are even? I've tried using custom css classes with text-align: center and vertical-align:middle but none of that worked.
EDIT: For reference here is the code:
<mat-form-field class = "chiplist" *ngIf="advancedFilterList.length > 0">
<mat-chip-list class="mat-chip-list-stacked" aria-orientation="vertical">
<mat-chip *ngFor="let advancedFilter of advancedFilterList" [selectable]="selectable"
[removable]="removable" (removed)="remove(advancedFilter)" (click)="changeUnitSymbolAndPopulateFieldsWithSelectedFilterData(advancedFilter)">
<mat-icon matChipRemove>cancel</mat-icon>
<div [innerHTML]="getFullFilterDescription(advancedFilter)"></div>
</mat-chip>
</mat-chip-list>
</mat-form-field>

You should delete the class "mat-chip-list-stacked", since it has a width of 100%, so you would already see the mat-chip centered. If you want to add CSS, create your own class and add the corresponding styles
Example: mat-chip center

Related

What is the class for min width using Bootstrap 5?

I looked at the documentation for Bootstrap 5 but I can't seem to find the min-width class using pixels? Is there any?
https://v5.getbootstrap.com/docs/5.0/utilities/sizing/
Bootstrap CSS Grid layout does the heavy lifting in terms of setting responsive breakpoints.
Each view/page/front-end element can be divided into 12 parts. and you can choose how much space a container takes out of 12 vertical columns.
Bootstrap 5 gives you 6 breakpoints pre-defined, with the following syntax
col-xs-{number-between-1-to-12} width <= 540px
col-sm-{number-between-1-to-12} max-width = 540px
col-md-{number-between-1-to-12} max-width = 720px
col-lg-{number-between-1-to-12} max-width = 960px
col-xl-{number-between-1-to-12} max-width = 1140px
col-xxl-{number-between-1-to-12} width <= 1400px
Example 1: You get a parent div with 2 child divs, these children will take equal divided space inside for all screen sizes
<div id="i-am-a-parent-div">
<div class="col-6"> This takes First Half the Space inside parent element</div>
<div class="col-6"> This takes Second Half the Space inside parent element</div>
</div>
Example 2: The Children divs will share 6/12 space each till max-width=540, but then they will change space occupation to 4/12 and 8/12 respectively.
NOTE: I've added two separated classes for each child div, you can add as many as needed for each breakpoint.
<div>
<div class="col-sm-6 col-md-4"> This takes First Half (6/12) the Space inside parent element till max-width = 540px,
BUT it will only take One-Thirds (4/12) the space between 540px & 768px </div>
<div class="col-sm-6 col-md-8"> This takes Second Half (6/12) the Space inside parent element till max-width = 540px,
BUT it will only take Two-Thirds (8/12) the space between 540px & 768px </div>
</div>
If this doesnt satisfy what you need to do, Then there are more customization options to their breakpoints, Feel free to checkout: https://v5.getbootstrap.com/docs/5.0/layout/grid/#grid-options
Let me know if this helps you out!

Angular Material vertical percentage space

How can I make one div to take certain percent of parent space verically?See the code below:
<div layout="column">
<div id="div1" flex="70%"></div>
<div id="div2" flex="30%"></div>
</div>
I want to make div1 70% height and div2 30% height of parent div. But it does not work. Div 1 and div 2 collapsed. But if the parent layout is row, it works fine---div1 takes 70% percent space horizontally.
I think you need to make the following modifications:
Specify a "height" to your outside div. This could be a percentage or pixels.
Do not use the % sign with the flex attribute
See this codepen: http://codepen.io/sebastiengiroux/pen/jPovxG
<div layout="column" style="height: 100%;">
<div id="div1" flex="70" style="background-color:red;"></div>
<div id="div2" flex="30" style="background-color:blue;"></div>
</div>
If you look into Layout docs https://material.angularjs.org/latest/layout/introduction
there is this statement that I think is relevant to your problem.
The flex attribute value is restricted to 33, 66, and multiples of five.
For example: flex="5", flex="20", flex="33", flex="50", flex="66", flex="75", ....
So I guess if you use allowed values, you can achieve results that you need. For example using 66 and 33.

Jquery mobile grid layout with text areas

I need to create a a 2x2 grid for a mobile website where the cells are text areas. The problem is that when I do this there doesn't seem to be a way where the text boxes all join together at the inner-most corner. All I am able to achieve is two separate text boxes on top of two other separate text boxes none of which are touching vertically of horizontally. I have tried to manipulate the margins, padding, and borders, but nothing works. Thanks for your help!
Working example: http://jsfiddle.net/Gajotres/cGt2J/
CSS used:
.ui-input-text {
border-radius: 0 !important;
margin:0 !important;
}

How to align a script after a div size for every resolution?

So i have this div containing a contact script:
<div id="contactbox" style="">
<form enctype="multipart/form-data" method="post" action="http://www.response-o-
matic.com/mail.php" accept-charset="UTF-8">here's the script</form>
</div>
</div>
I'm wondering if there is any way to align a script after the wrapper size for every resolution.Because i set the position of the script in percentage and on my resolution it looks centered in wrapper.But on a bigger resolution for example it's not working,it's a little bit in left side,that means the script goes after the html size because it focuses after it and it goes in the middle.
I know that if i set the wrapper with:
.wrapper
{
text-align:center;
}
then every texts from the wrapper will be centered after his size,but with scripts isnt working.So is there any way?

Highcharts tooltip is hidden behind other charts

When putting multiple charts tooltips from upper charts are hidden behind others.
I found some tips on how to it but nothing helped.
Is there anyway to keep tooltips on top of charts?
The example is here: http://jsfiddle.net/Zw3uM/
Thanks a lot!
This is pure html : Any div element loaded after ( meaning appearing after on the html page) will always be in front.
In order to get the first chart tooltip be in front of the second : load the second in first and set its y position on the page using an absolute or relative position in css :
I've change their order, putting the container2 in first in html:
<div id="container2" style="height: 200px"></div>
<div id="container1" style="height: 200px"></div>
Then set the position of container2 to be under the first one (thanks to the top style attribute) :
div[id="container2"] {
position:absolute;
top:200px;
}
Here is the result : http://jsfiddle.net/Zw3uM/3/
You can use tooltip pisitioner:
http://api.highcharts.com/highcharts#tooltip.positioner
The problem is due to each highchart container having its own stacking context. This is because the highcharts-container has both position: relative and z-index: 0 (css dynamically applied by the highcharts library).
So the z-index of the tooltip has meaning only in its parent highchart container.
To fix this we need to override the (z-index: 0) rule for the highcharts-container using the following:
.highcharts-container
{
z-index: auto !important;
...
}
This way all hightcharts-containers & their children would share the same stacking context and their z-indices would apply the desired effect.
You can check the fix here: http://jsfiddle.net/w5bLo1cw/4/

Resources