Material UI 提供了 npm 包的形式。
传统的方式是直接引入 .css 文件,如:<link rel="stylesheet" href="node_modules/normalize.css/normalize.css" />,但是我现在想让 Angular 通过 import 模块的方式自动为 index.html 引入 normalize.css 样式表。我先是按照之前引入 Material 2 的方式:
// angular-cli-build.js
module.exports = function(defaults) {
return new Angular2App(defaults, {
vendorNpmFiles: [
'normalize-path/index.js',
]
})
}
// system-config.ts
const map: any = {
'normalize': 'vendor/normalize-path',
}
/** User packages configuration. */
const packages: any = {
'normalize': {main: 'index.js'},
}
// app.component.ts
import { normalize } from 'normalize-path'
这时编辑器会提示:
Cannot find module 'normalize-path'.
并且编译也不通过,也许我的出发点是错的。
margin是css里的,margin-top, margin-right, margin-bottom, margin-left, 控制块级元素之间的距离, 它们是透明不可见的比如你想让div距离上面有50象素,那就是margin-top:50px
至于你说的material,没见过,刚百度了下,只见到
PHP头像生成类 Material Design Avatars