[Angular] Separating Structural Styles From Theme Styles - Making Components Themeable

For the component‘s css file, we can improt two css files:

  • common.css
  • default-theme.css
@import "common.css";
@import "au-fa-input-default-theme.css";

In the default theme, it contains all the default theme related style.

:host {
  border-color: lightgrey;
}

:host(.input-focus) {
  border-color: #4D90FE;
  -webkit-box-shadow: 0 0 5px  #4D90FE;
  box-shadow: 0 0 5px  #4D90FE;
}

In the common.css, it contains all the common style for different themes:

/*Common for all input fields*/
.icon {
  width:20px;
  text-align: center;
  padding-left: 5px;
  padding-right: 2px;
  border:none;
  vertical-align: middle;
}

:host {
  border-width:1px;
  border-style: solid;
  padding: 1px 0;
  display: inline-block;
}

:host(.input-focus) {
  outline: none;
}

:host /deep/ input {
  border:none ;
  outline: none;
  height: 100%;
  box-sizing: border-box;
}
时间: 2024-11-05 18:52:22

[Angular] Separating Structural Styles From Theme Styles - Making Components Themeable的相关文章

[Angular] Define a custom Material theme

// include all the scss @import "[email protected]/material/theming"; // Include non-theme styles for core. @include mat-core(); $mat-custom-primary-theme: ( 50: #ffebee, 100: #ffcdd2, 200: #ef9a9a, 300: #e57373, 400: #ef5350, 500: #e1234e, 600:

[Angular 2] ng-class and Encapsulated Component Styles

import {Input, Component, View, NgClass} from "angular2/angular2"; @Component({ selector: 'todo-item-render' }) @View({ directives: [NgClass], styles: [` .started{ color: green; } .completed { text-decoration: line-through; } `], template: ` <

Bootstrap Metronic 学习记录(二)菜单栏

1.简介 1)  .环境配置 2)  .提取页面 2).动态生成菜单(无限级别树) 2.系统环境配置 项目需要程序数据支撑,这里选择MVC5.0+EF6.0[SQLSERVER](不对MVC架构和SQLServer做出解读) 运行环境:VS2013+MVC5.0+EF6.1+SQLServer2012 解决方案名称:AppSolution 项目名称:App.Web(UI层)与App.Models(数据访问层) -直接访问模式 提取theme下的所有文件到MVC的Content,提取admin的i

MVC+BootStrap 企业通用型框架搭建 ---(2)框架布局及模板页的创建

模板页面介绍 _Header.cshtml头部页面 ,_Footer.cshtml底部页面 ,Main.cshtml框架主页面, _Theme.cshtml(主题页面),_Menu.cshtml(左侧菜单页面),_Style.cshtml(通用样式页面) _Header.cshtml 代码: @{ ViewBag.Title = "_Header";}<script type="text/ecmascript"> $(function () { $(&q

Android 更改按钮样式 Button Styles

extends:http://stackoverflow.com/questions/26346727/android-material-design-button-styles   I will add my answer since I don't use any of the other answers provided. With the Support Library v7, all the styles are actually already defined and ready t

[React] Radium: Updating Button Styles via Props

In a CSS library like Bootstrap we can set a button's style to be "primary" or "secondary" by appending classes. For React components we want to be able to do this via props. Radium enables this by composing styles via an array. This m

[CSS MASTERY]CHAPTER 2: Getting Your Styles to Hit the Target

A valid and well-structured document provides the foundations to which your styles are applied. To be able to style a particular HTML element using CSS, you need to have some way of targeting that element. In CSS the part of a style rule that does th

LitElement(三)Styles样式

1.为组件添加样式 import { LitElement, css, html } from 'lit-element'; class MyElement extends LitElement { static get styles() { return css` div { color: red; } `; } render() { return html` <div>I'm styled!</div> `; } } 如同 static get properties()属性一样

angular项目中使用angular-material2

Step 1: Install Angular Material and Angular CDK npm install --save @angular/material @angular/cdk npm install --save angular/material2-builds angular/cdk-builds Step 2: Animations Some Material components depend on the Angular animations module in o