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

Material-card too wide for usage in flex grid system #247

Closed
Frank3K opened this issue Sep 6, 2014 · 6 comments
Closed

Material-card too wide for usage in flex grid system #247

Frank3K opened this issue Sep 6, 2014 · 6 comments
Assignees
Milestone

Comments

@Frank3K
Copy link
Contributor

Frank3K commented Sep 6, 2014

I would expect that three <material-card flex=33>'s could be stacked horizontally in a <material-content layout="horizontal">-container. Unfortunately this makes the page too wide (i.e. wider than the window width).

As far as I can see this is the result of the rule margin: $card-margin; for material-card (in _card.scss), where $card-margin is currently 10px (in _variables.scss). Setting the margin to 0 is no option layout-wise; the card is hardly recognizable then.

Example plunkr: http://plnkr.co/edit/vHckwcMApTIcRev5KF9e

@ajoslin ajoslin closed this as completed in f33185f Sep 8, 2014
@ajoslin
Copy link
Contributor

ajoslin commented Sep 8, 2014

Fixed. It will fit in fine now - the problem was the inner image's css sizing the image wrong.

@Frank3K
Copy link
Contributor Author

Frank3K commented Sep 9, 2014

Unfortunately I don't think it's fixed. I've updated the plunkr to the currently latest version (v0.0.2-master-a69ac48).

The problem still persists: the material-card itself (still) has a margin which leads to the problem.

Due to the change (f33185f) the image inside the material-card looks different now. Previously it filled the whole width of the card, as can be seen in the plunkr from three days ago.

@Frank3K
Copy link
Contributor Author

Frank3K commented Jan 13, 2015

@ajoslin: This isssue was reintroduced in a2bc3c6. Should I open a new issue for that (since I can not re-open this one). Updated plunkr.

@ajoslin ajoslin reopened this Jan 14, 2015
@ajoslin ajoslin self-assigned this Jan 14, 2015
@ajoslin ajoslin added this to the 0.7.0 milestone Jan 14, 2015
@ThomasBurleson ThomasBurleson modified the milestones: 0.7.0, 0.7.1 Jan 15, 2015
@naomiblack naomiblack modified the milestones: 0.7.1, 0.8.0 Jan 26, 2015
@robertmesserle robertmesserle modified the milestones: 0.9.0, 0.8.0 Feb 19, 2015
@marcysutton marcysutton modified the milestones: 0.10.0, 0.9.0 Apr 13, 2015
@marcysutton
Copy link
Contributor

md-card needs to maintain margins no matter how many items there are or what it is inside of. To solve the issue of cards being too wide, you can wrap them in another element with flex. Like this:

<div flex=33>
      <md-card>
        <img class="md-card-image" src="http://placehold.it/350x150" />
        <md-card-content>
          <span>Card 1</span>
        </md-card-content>
      </md-card>
    </div>

Here is an updated Plunker with the latest markup: http://plnkr.co/edit/nE7kMhFoObJdQyEdFSjF?p=preview

@mavillar
Copy link

mavillar commented Mar 8, 2016

@marcysutton running your script, the result is md-card is 100% width, not 33%

@marcysutton
Copy link
Contributor

The API may have changed. If there is still a problem with it, please open a new issue. (Also note: I no longer work full-time on Angular Material)

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

No branches or pull requests

7 participants