Thank you for taking a look at my question. I have a div that is expanding across the page horizontally, which is what I want. I have 4 buttons in the div and I am using:
<div layout="row" layout-align="space-around center" layout-sm="column" layout-fill layout-wrap >
Which is good. However, it is taking up the whole div so the buttons look awkwardly spaced out. So I added flex="33" and now they are spaced out, but stuck in using only a third of the page which is what I want and it looks good. The issue I have is it is taking up the first third and I want it to use up the second third of the page. Is there a way to do this with out creating unnecessary divs to occupy the first third?
Here is the complete code:
<div flex="33" layout="row" layout-align="space-around center" layout-sm="column" layout-fill layout-wrap class="pageNavButtons">
<div ng-repeat="button in navPage" layout="column" layout-align="center center" style="color: #ffffff">
<label>{{button.div}}</label>
<span></span>
<md-icon md-svg-src="{{button.icon}}"></md-icon>
</div>
</div>
I do not have any CSS with it yet.
Images:
Before flex=33
After adding it:
You can achieve that by either using flex-offset="33" or by adding layout-align="center" layout="row"on the parent. I would probably use the second one.
<div div layout="row" flex-offset="33">
<div flex="33" layout="row" layout-align="space-around center" layout-sm="column" layout-fill layout-wrap class="pageNavButtons">
<div ng-repeat="button in navPage" layout="column" layout-align="center center" style="color: #ffffff">
<label> {{button.div}}</label>
<span>----- </span>
<md-icon md-svg-src ={{button.icon}}></md-icon>
</div>
</div>
</div>
or
<div layout="row" layout-align="center">
<div flex="33" layout="row" layout-align="space-around center" layout-sm="column" layout-fill layout-wrap class="pageNavButtons">
<div ng-repeat="button in navPage" layout="column" layout-align="center center" style="color: #ffffff">
<label> {{button.div}}</label>
<span>----- </span>
<md-icon md-svg-src ={{button.icon}}></md-icon>
</div>
</div>
</div>
http://codepen.io/kuhnroyal/pen/mPVdRK
Related
I need to set height of data grid automatically depending og children height. I have 2 rows and 2 columns, but when I set height of card, and for example enter looooong text in "p" child, i just get hidden overflow.
Ideally it would be to have row height depending on heigher of 2 children.
Current html:
<mat-grid-list cols="2" rowHeight="200px" gutterSize="30px">
<mat-grid-tile [colspan]="1" [rowspan]="1">
<div fxFlex="100%" fxLayout="row">
<div fxFlex="20%" fxLayoutAlign="center center">
<img [src]="src" [matTooltipPosition]="'above'"/>
</div>
<div fxFlex="80%" fxLayout="column" fxLayoutAlign="center none">
<div>
<div>MY LABEL</div>
<p>loong description</p>
</div>
<div>
<a>link</a>
</div>
</div>
</div>
</mat-grid-tile>
etc..
Any ideas?
Thx...
I am new to Angular Material Design so I have some trouble making webapps cross-browser.
Here's my problem
These 3 items are stacked on IE but not on Chrome and Firefox.
And I want them to be exactly like on Chrome/Firefox
Apparently the problem is coming from "layout-align='center center'" because if I just use "layout-align='center'" they're not stacked on IE anymore but they're appearing aligned on the left on every browser.
Here's the HTML:
<div layout="column" layout-align="center center" style="text-align:center;" style="min-height:400px" ng-repeat="(title,score) in results.scoreByCategories">
<h4>{{title}} :</h4>
<div layout="row" layout-xs="column" >
<div flex>
<p id="button-debutant" class="rcorners">Débutant</p>
</div>
<div flex>
<p id="button-intermediaire" class="rcorners">Intermédiaire</p>
</div>
<div flex>
<p id="button-confirme" class="rcorners">Confirmé</p>
</div>
</div>
</div>
Here's my CSS :
.rcorners{
color: grey;
border-radius: 25px;
background-color: #e7e7e7;
padding: 7px;
width: 110px;
height: 20px;
float:left;
margin: 5px 12px
}
Feel free to point out my mistakes! Thanks!
I've found a solution for your problem
You only have to replace this block of code (written by you)
<div layout="row" layout-xs="column" >
<div flex>
<p id="button-debutant" class="rcorners">Débutant</p>
</div>
<div flex>
<p id="button-intermediaire" class="rcorners">Intermédiaire</p>
</div>
<div flex>
<p id="button-confirme" class="rcorners">Confirmé</p>
</div>
</div>
with this one:
<div layout="row" layout-xs="column" layout-align="center center" >
<div>
<p id="button-debutant" class="rcorners">Débutant</p>
</div>
<div >
<p id="button-intermediaire" class="rcorners">Intermédiaire</p>
</div>
<div>
<p id="button-confirme" class="rcorners">Confirmé</p>
</div>
</div>
Basically you will force IE to consider the three button as an unique row, while the layout-align="center center" written before (where there is the ng-repeat) will align the whole portion of page in the center of the page (both vertically and horizontally). I don't why IE requires this little extra work but it works :)
I hope I helped you
You can see rows in picture.
This is code of that view:
<div layout="row" layout-align="space-around center" >
<product-image-thumbnail layout="row" layout-align="left center"
src="vm.callFunction(field)"
setter="vm.callFunction(value)" />
<md-button ng-click="vm.onMouseOver(field.getSrc))" layout="row" layout-align="right center">
<md-icon>zoom_in</md-icon>
</md-button>
</div>
I want to align image or uploadanimage to left, zoom button to right.
But it doesnot work.
i also tried
layout-align="start start
layout-align="end end"
but it did not do the job.
Also i tried buttons to convert to column but it is same.
it makes two rows if i dont put first layout. i need them inside a row.
this is where src image comes
<div ng-show="!vm.src" layout="row">
<md-button class="md-button md-ink-ripple" ng-click="vm.Dialog($event)">
<md-icon>file_upload</md-icon>
<span translate>upload_image</span>
</md-button>
</div>
<div ng-show="vm.src" class="thumbnail" layout="column" layout-align="center center" flex layout-padding ng-click="vm.Dialog($event)">
<img src="{{vm.src}}" style="max-height: 60px;max-width: 60px"
error-src="content/images/no_image_icon.gif"
/>
</div>
<p>This is some text. <img src="smiley.gif" alt="Smiley face" width="42" height="42" align="left"> This is some text.</p>
If you want to use angular material, try using the space-between param. Example Plunker.
<div><!-- shouldn't need layout here-->
<img layout="row" layout-align="space-between center" />
<button layout="row" layout-align="space-between center">Zoom</button>
</div>
You can try this way,
<section layout="row" layout-align="end center" layout-wrap>
<div layout="row" layout-align="start center" flex>
<img src="https://echtemaaltijd.blob.core.windows.net/image/image_671ed3d3-0c1e-43d5-9e9a-86247556fd00" class="md-card-image" alt="Washed Out">
<span flex></span>
</div>
<md-button class="md-warn">Type</md-button>
</section>
DEMO
Try this with flex!
<div layout="row" layout-alignment="stretch">
<product-image-thumbnail flex
src="vm.callFunction(field)"
setter="vm.callFunction(value)" />
<md-button ng-click="vm.onMouseOver(field.getSrc))" flex="5">
<md-icon>zoom_in</md-icon>
</md-button>
</div>
The flex Will take up as much space as it can till 95% of the available width and flex=5 will ensure it is 5$
I am in trouble with angular material layout..
Got this:
this one is just to show the whole html
<div id="MainLayout" layout="column" flex style="height: 100%; overflow: hidden">
<div id="pageHeader" layout="row">
<div layout="column" flex>
<div layout="row" flex>
<img ng-repeat="icon in main.social" class="social" src="{{icon.path}}"/>
</div>
<div layout="row" flex></div>
</div>
</div>
it is about this block:
<div id="LogoDisplay" layout="row" flex="50" ng-style="main.styles.text" style="background: #F9F9F9">
<div layout="column" layout-align="center center" flex fill>
<div id="LogoImage" layout="row" layout-align="center center"><img src="assets/images/user-foto-logo.png" style="???"></div>
<div id="LogoTitle" layout="row" layout-align="center end">User Name</div>
<div id="LogoText" layout="row" layout-align="center start">Job Title</div>
</div>
</div>
and least I got this
<div id="ImageDisplay" flex="50" layout="row" layout-align="center center">
<div ng-repeat="icon in main.icons">{{icon}}</div>
</div>
<div id="pageInfo" layout="row" style="background: #123; color: #FFFF88;">some info footage</div>
I marked the code with ???
There is my problem, got 4 rows, row #1 gots some icons and #4 is just text...
row 2 contains a logo and two rows of text
row 3 contains a couple of logos
My Problem: I would like to have rows 2 and 3 filling 50% of the height. the logo should take 50% of row 2 and the both texts should fit to width of the logo...
I am using ui-view in md-content to display a list but its getting overflow i want list in md-content should be scrollable
here is my index.html
<div layout-lt-lg="row" class="screen-bg">
<div flex-lt-lg="100">
<!--header-->
<md-toolbar class="app-bar-bg" style="background-color: #9013fe;">
<div class="status-bar-bg"></div>
<div class="md-toolbar-tools">
<md-button class="md-icon-button" aria-label="Settings">
<!--<md-icon md-svg-icon="app/images/back1.svg"></md-icon>-->
</md-button>
<h2>
<span></span>
</h2>
<span flex=""></span>
<md-button class="md-icon-button" aria-label="Favorite">
<!--<md-icon md-svg-icon="app/images/a.svg"></md-icon>-->
</md-button>
</div>
</md-toolbar>
<!--content-->
<div>
<md-content>
<ui-view></ui-view>
</md-content>
</div>
</div>
</div>
here is my template
<md-list flex>
<md-list-item class="md-3-line" ng-repeat="broadCast in broadCasts">
<div class="md-list-item-text" layout="column" >
<h3>{{broadCast.name}}</h3>
<h3>{{broadCast.phone}}</h3>
</div>
</md-list-item>
</md-list>
To make the list scrollable:
Add a class to md-list.
<md-list class="make-scrollable" flex>
<md-list-item class="md-3-line" ng-repeat="broadCast in broadCasts">
<div class="md-list-item-text" layout="column">
<h3>{{broadCast.name}}</h3>
<h3>{{broadCast.phone}}</h3>
</div>
</md-list-item>
</md-list>
Style the md-list in your css file like so:
md-list.make-scrollable {
height: 600px; //Or any other height you wish
overflow-y: scroll;
}
That should make the overflowing content scrollable
You are using too many unnecessary container elements.
<div layout-lt-lg="row" flex-lt-lg="100" class="screen-bg">
<!--header-->
<md-toolbar class="app-bar-bg" style="background-color: #9013fe;">
<div class="status-bar-bg"></div> //desired controller buttons
<div class="md-toolbar-tools"></div> //desired controller buttons
</md-toolbar>
<!--content-->
<md-content flex ui-view>
</md-content>
</div>
Here is a working example. There are some changes but basic structure is almost same.