0

I am trying to build a dialog using AngularMaterial and in the demo it has css code:

.dialogdemoBasicUsage #popupContainer {
  position: relative; 
}

.dialogdemoBasicUsage .footer {
  width: 100%;
  text-align: center;
  margin-left: 20px;
}

.dialogdemoBasicUsage .footer, .dialogdemoBasicUsage .footer > code {
  font-size: 0.8em;
  margin-top: 50px; 
}

.dialogdemoBasicUsage button {
  width: 200px; 
}

.dialogdemoBasicUsage div#status {
  color: #c60008; 
}

.dialogdemoBasicUsage .dialog-demo-prerendered md-checkbox {
  margin-bottom: 0; 
}

In my angularJS project - where do I put this code? do i create a new .css file and then reference it and do I have to put anything around it?

1
  • inside <HEAD> just like a normal HTML Page. Commented Nov 16, 2016 at 7:01

2 Answers 2

2

It is the same way how you do it in normal HTML application.

Add the css code to a file named style.css , refer it inside

<head>
  <title>To Do List</title>
  <link href="style.css" rel="stylesheet" />
</head>

DEMO

Sign up to request clarification or add additional context in comments.

5 Comments

I'm using bootstrap, so i am already including: <link rel="stylesheet" href="css/bootstrap.min.css">. Can I just add another one?
@WaterBoy Yes you can add n number of scripts,but some styles may overwrite
thanks so much. and in the .css file I create - do I simply put the css code (from my question) as is?
@WaterBoy yes you can
use the CDN. Here is the link: maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css This will work just fine
1

In normal use case you should include the CSS file come with the library.

By the user guide of material CSS, you should include these files in your HTML

<html lang="en" >
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <!-- Angular Material style sheet -->
  <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.css">
</head>
<body ng-app="BlankApp" ng-cloak>
  <!--
    Your HTML content here
  -->  

  <!-- Angular Material requires Angular.js Libraries -->
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-animate.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-aria.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.5.5/angular-messages.min.js"></script>

  <!-- Angular Material Library -->
  <script src="http://ajax.googleapis.com/ajax/libs/angular_material/1.1.0/angular-material.min.js"></script>

  <!-- Your application bootstrap  -->
  <script type="text/javascript">    
    /**
     * You must include the dependency on 'ngMaterial' 
     */
    angular.module('BlankApp', ['ngMaterial']);
  </script>

</body>
</html>

<!--
Copyright 2016 Google Inc. All Rights Reserved. 
Use of this source code is governed by an MIT-style license that can be in foundin the LICENSE file at http://material.angularjs.org/license.
-->

If you need further modification on top of their CSS, make a new CSS file and include it below angular-material CSS file in <head>

1 Comment

Super helpful thanks - those extra dependency files were critical.

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.