0

How to style material js component in inline style or my local css file.I have tried using defining class in directive like below code,

<md-card style="width: 20px;">
1

2 Answers 2

0

Why not use flex?

<div layout="row">
  <md-card flex="20"></md-card>
</div>
Sign up to request clarification or add additional context in comments.

Comments

0

To style the md-card, give a class or id to the md-card tag and apply CSS to it.

Refer to https://codepen.io/narmadamurali02/pen/LYrzwJz

HTML code

<section ng-app="app">
<article ng-controller="MainCtrl">
<div layout="row" layout-align="start start" layout-fill>
  <md-card id="preview-table" class="preview-outer-container" style="width: 550px; height: 370px;">
    <md-toolbar id="preview-header">
      <div>card header
      </div>
    </md-toolbar>
    <md-card-content class="pa-5">
      <div>
        card body
      </div>
      <md-card-content />
  </md-card>
  </div>
  </article>
  </section>

CSS code

.preview-outer-container {
  box-shadow: none;
  border: 1px solid #ddd;
}

#preview-header {
  background: #000;
  border-bottom: 1px solid $border-color;
  font-size: 12px;
  min-height: 30px;
  color: #fff;
  height: 25px;
  cursor: move;
  padding: 10px;
}

JS code

var app = angular.module("app", ["ngMaterial"]);
 app.controller("MainCtrl", ctrl);
 function ctrl($scope, $element) {}

In the above example, I have removed the box-shadow to md-card and for md-toolbar I have overridden the default color blue to black.

Output: https://i.sstatic.net/fdvfL.png

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.