【问题标题】:Customize styling of not selected md-tab-label from md-tab从 md-tab 自定义未选择的 md-tab-label 的样式
【发布时间】:2016-09-20 09:50:36
【问题描述】:

我尝试为我的 Angular Material 应用程序开发以下用户界面。但我不知道如何在 CSS 中自定义所有未选中的 md-tabs。

This is what I want to have.

Current version

HTML 代码:

        <md-tabs class="md-primary" md-selected="selectedIndex" md-align-tabs="top" md-autoselect md-dynamic-height id="top">
            <md-tab ng-repeat="tab in tabs" flex layout="column" layout-fill>
                <md-tab-label>
                    <div layout="row" layout-fill>
                        <div class="md-tab-item-index">
                            <span>{{tab.index}}</span>
                        </div>
                        <div class="md-tab-item-label">
                            {{tab.title}}
                        </div>
                        <div class="md-tab-item-label-separator"></div>
                    </div>
                </md-tab-label>
                <md-tab-body>
                    <div ng-include="tab.content"></div>
                </md-tab-body>
            </md-tab>
        </md-tabs>

CSS

.md-tab-item-label {
    color: white;
    font-size: 14px;
    line-height: 20px;
    text-transform: capitalize;
}

.md-tab-item-label-separator {
    background-color: rgba(255, 255, 255, 0.5);
    -webkit-box-flex: 0 1 auto;
    -webkit-flex: 0 1 auto;
    flex: 0 1 auto;
    height: 1px;
    min-width: 0;
    position: relative;
    top: 12px;
    width: 68px;
    margin-left: 10px;
}

.md-tab-item-index {
    background-color: #ffffff;
    -webkit-border-radius: 50%;
    border-radius: 50%;
    -webkit-box-flex: 0 0 auto;
    -webkit-flex: 0 0 auto;
    flex: 0 0 auto;
    font-size: 12px;
    font-weight: 500;
    height: 24px;
    line-height: 24px;
    position: relative;
    text-align: center;
    width: 24px;
    color: #000000;
    margin-right: 10px;
}

【问题讨论】:

标签: javascript html css angularjs angular-material


【解决方案1】:

简单:

md-tab ng-scope ng-isolate-scope md-ink-ripple md-active 那是活跃的一个

md-tab ng-scope ng-isolate-scope md-ink-ripple 那是不活跃的一个

使用你的风格,然后为活跃的人准备特殊的风格。

【讨论】:

  • 我已经尝试过您的解决方案,但它不起作用。你能在 Fiddle 中实现你的解决方案吗? jsfiddle.net/mueller92/c9w521ka
猜你喜欢
  • 1970-01-01
  • 2017-06-29
  • 2023-03-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-06-30
  • 1970-01-01
  • 2017-12-21
相关资源
最近更新 更多