components icon indicating copy to clipboard operation
components copied to clipboard

[md-subheader] What's point of margin-top for first child?

Open chouclee opened this issue 10 years ago • 2 comments

Bug, feature request, or proposal:

(Bug? Request?) Not sure. I didn't find the specs of material subheader that contains following style:

@mixin md-subheader-base($top-padding, $secondary-size, $base-height) {
   ...
   ...
  &:first-child {
    margin-top: -$top-padding;
  }
}

Couldn't see much difference for normal use cases.

However, if user created some md-subheader using *ngIf, the md-subheader would be wrapped inside extra <div></div>. Thus styles for first-child would be effective and we could notice inconsistent behaviors for md-subheaders. Check the plunker link below (different margins for md-subheader)

What is the expected behavior?

Consistent margin behavior for all md-subheaders

What is the current behavior?

See above

What are the steps to reproduce?

http://plnkr.co/edit/I1kueZi21gdktAGLIupS?p=preview

What is the use-case or motivation for changing an existing behavior?

Use-case: md-subheader is created using ngIf

Which versions of Angular, Material, OS, browsers are affected?

Angualr 2.1.0 Material: master branch OS: Mac OS 10.11.6 Browsers: Chrome, Firefox, Safari

Is there anything else we should know?

Nope

chouclee avatar Nov 09 '16 01:11 chouclee

https://material.google.com/components/lists.html#lists-specs "Add 8dp of padding at the top and bottom of a list, except for lists with subheaders, which have their own padding."

So I guess the margin-top is supposed to offset the padding of list if md-subheader is the first child of md-list.

chouclee avatar Nov 09 '16 19:11 chouclee

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.