Material: mdList: how to make md-list-item item row height smaller

Created on 24 Feb 2016  路  5Comments  路  Source: angular/material

Currently, I have to

When I have simple markup like this:

<md-list ng-controller="ListCtrl" ng-cloak="" class="listdemoListControls" ng-app="MyApp">
  <md-list-item ng-repeat="message in messages">
      <md-checkbox class="green" ng-model="message.selected">
    </md-checkbox> 
       <p style="" >{{message.title}}</p> 
  </md-list-item>
</md-list>

There's unnecessary gaps. The only way I was able to figure out how to fix it (after about 4 hours of fighting with css, is by adding the following style:

<style>
md-list-item, md-list-item .md-list-item-inner, md-checkbox {
    min-height: 100%;
}
</style>

here's a pen: http://codepen.io/kasajian/pen/XdrrQY

Is there a more proper way to do this?

High Density

Most helpful comment

So the default styling is:

md-list-item, md-list-item .md-list-item-inner {
  min-height: 48px;
  height: auto;

  display: flex;
  justify-content: flex-start;
  align-items: center;
}

and the override:

md-list-item, md-list-item .md-list-item-inner {
    min-height: 20px;
    height: 25px;
}

All 5 comments

There is no easy way to get that running, we only support the default list styles, which are specified in the official specs - https://www.google.com/design/spec/components/lists.html#lists-specs

So the default styling is:

md-list-item, md-list-item .md-list-item-inner {
  min-height: 48px;
  height: auto;

  display: flex;
  justify-content: flex-start;
  align-items: center;
}

and the override:

md-list-item, md-list-item .md-list-item-inner {
    min-height: 20px;
    height: 25px;
}

Thank you for the high-density styling question.

Thank you. Wish I knew what that "CSS: High Density" label meant

Now broken with version on master. See continuation: https://github.com/angular/material/issues/7346

Was this page helpful?
0 / 5 - 0 ratings