Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

How to wrap cards across rows? #498

Closed
kpgarrod opened this issue Oct 29, 2014 · 10 comments
Closed

How to wrap cards across rows? #498

kpgarrod opened this issue Oct 29, 2014 · 10 comments
Milestone

Comments

@kpgarrod
Copy link

I have an unknown number of cards, with a width of say 300px. If the cards are too wide to fit in a row, I want them to automatically wrap onto the next row. This is my best effort:

<div layout="horizontal">
  <md-card ng-repeat="resourceType in resourceTypes"
           flex
           layout="vertical"
           ng-click="openDialog(resourceType.type)"
           class="cc-basic-card"> <!-- Just adds a min-height and min-width -->
    <h2>{{resourceType.name}}</h2>
    <p>{{resourceType.description}}</p>
 </md-card>
</div>

It doesn't wrap. Is there a simple way of doing this please?

@Frank3K
Copy link
Contributor

Frank3K commented Oct 29, 2014

As far as I know this is not possible using material alone, but I hope this will be added in the future.

I think it is possible using the CSS flex-wrap property MDN.

Unfortunately, flex-wrap is IE11+.

@plato-cambrian
Copy link

try display: inline-block on the cards

this will probably leave vertical gaps if the cards are not the same height

if you are unhappy with these gaps you could try angular-masonry

@madvas
Copy link

madvas commented Nov 9, 2014

I hit the same problem. display: inline-block; didn't wrap cards, but instead made my row to go far beyond screen size. It would be nice if material could solve this problem out of the box :)

@ThomasBurleson ThomasBurleson added this to the 0.8.0-rc1 milestone Nov 14, 2014
@thienedits
Copy link

Yea I was able to do this with the flex-wrap property

http://jsfiddle.net/thienedits/dnzn0455/

@plato-cambrian
Copy link

Awesome, what a great way to get around the inline-block extra whitespace problem

I would like to have a layout-wrap attribute:

[layout-wrap] {
  -webkit-flex-wrap: wrap;
      -ms-flex-wrap: wrap;
          flex-wrap: wrap;
}

dunno if the prefixes are still needed

@kpgarrod
Copy link
Author

I am also using flex-wrap and experiencing some issues with the positioning
of tooltips. Shall I make a plunker?
On 15 Nov 2014 02:54, "plato" notifications@github.com wrote:

Awesome, what a great way to get around the inline-block extra whitespace
problem http://jsfiddle.net/ct9qk6ux/

I would like to have a layout-wrap attribute:

[layout-wrap] {
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}

dunno if the prefixes are still needed


Reply to this email directly or view it on GitHub
#498 (comment).

@Frank3K
Copy link
Contributor

Frank3K commented Nov 15, 2014

PR: #634.

@mzbyszynski
Copy link
Contributor

I believe this issue can be closed now via @ajoslin's commit 4f755ea . Or is there still more work to be done here (maybe just a documentation task for layout-wrap)?

@kpgarrod
Copy link
Author

kpgarrod commented Dec 8, 2014

layout-wrap works for me, thanks.
On 8 Dec 2014 18:42, "Marc Zbyszynski" notifications@github.com wrote:

I believe this issue can be closed now via @ajoslin
https://github.com/ajoslin's commit 4f755ea
4f755ea
. Or is there still more work to be done here (maybe just a documentation
task for layout-wrap)?


Reply to this email directly or view it on GitHub
#498 (comment).

@ThomasBurleson ThomasBurleson modified the milestones: 0.8.0, 0.9.0 Jan 30, 2015
@estellederrien
Copy link

estellederrien commented Jun 16, 2017

Hello I have this problem, please help 👍
https://stackoverflow.com/questions/44589508/angular-material-md-card-paragraph-break-ng-repeat

impossible to break the paragraph each of the 3 iterations ng-repeat

kashyapkaki pushed a commit to kashyapkaki/material that referenced this issue May 10, 2023
- add more links to deployments
- add guidance on where to open issues
- add links to where source content comes from
- fix instructions for running locally
- add some troubleshooting notes

Fixes angular#498
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants