material icon indicating copy to clipboard operation
material copied to clipboard

Height and Width of md-button set to 100%. Is this intentional?

Open nikhildev opened this issue 12 years ago • 6 comments

Hi,

I took a look at the CSS and found this starting line# 1509

md-button .md-button-inner {
    display: block;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;

Setting the height and width to 100% is making the button to take up the entire space of the parent. Is this intentional?

I'm implementing the button as simple as

<md-button class="md-button-colored">Test</md-button>

nikhildev avatar Oct 27 '14 08:10 nikhildev

Hi @nikhildev this CSS rule seem to apply to a child element of md-button, with class md-button-inner, so the button itself should not take full height/width - and I didn't notice anything like so. AFAIK, the child element is an a element, (created at runtime by md-button directive) so it's expected that it takes all of the button real estate so it's clickable everywhere

pandaiolo avatar Oct 27 '14 09:10 pandaiolo

Hi @pandaiolo ,

What is strange is that I used dev tools to disable the height and width of the inner button element for the directive and the button appears normal(I think you meant that the child element is button).

What i discovered is that the parent is taking up the entire height and width of its parent(not sure why).

I've taken a screenshot with the element inspector. and css rules applied for the child button as well as the parent directive. None of the rules seem to be overriding the parent height rule.

inner child button parent directive

Can you please take a look and let me know if I'm doing something wrong?

FYI, I tried this with all other stylesheets disable except angular material css and still no go.

nikhildev avatar Oct 27 '14 11:10 nikhildev

Strange indeed,

Here is a plunckr from another issue : http://plnkr.co/edit/uhBxbU9wZSi1joRwq8Dw

Button is fine here, but maybe you can try reproduce your markup to find the cause of full height

pandaiolo avatar Oct 27 '14 11:10 pandaiolo

Its strange that this works on the plunkr and not with the set of my bower downloaded deps.

Here is a block of my bower deps

  "dependencies": {
    "angular": "~1.3.x",
    "angular-material": "~0.4.2",
    "angular-ui-router": "~0.2.11"
  }

Do you find something wrong here?

Here is how the ui-view written

<body>

  <div ui-view></div>

All my scripts are loaded at the very end. My partials do not use any other style apart from the core library provided css.

nikhildev avatar Oct 27 '14 15:10 nikhildev

Ok, I figured out what the problem. The html has a missing . Never thought this would break everything. Feel real silly about this.

nikhildev avatar Oct 27 '14 16:10 nikhildev

Thanks for sharing!

Indeed the doctype (or lack thereof) can break rendering :

DOCTYPEs are required for legacy reasons. When omitted, browsers tend to use a different rendering mode that is incompatible with some specifications. Including the DOCTYPE in a document ensures that the browser makes a best-effort attempt at following the relevant specifications.

(https://html.spec.whatwg.org/multipage/syntax.html#the-doctype)

pandaiolo avatar Oct 27 '14 17:10 pandaiolo