鍍金池/ 問答/HTML5  HTML/ vue scoped html 樣式無效

vue scoped html 樣式無效

登錄頁用了單獨的樣式,所以我想給登錄頁加 scoped 用來作用于當前頁面,但是html的效果沒有了,小級別的樣式可以

這個無效了
@media screen and (min-width: 1600px) {
  html {
    font-size: 100px;
  }
}

這樣的還有效:
.container {
  width: 100%;
  position: absolute;
  top: 43%;
  transform: translateY(-50%);
}
回答
編輯回答
不歸路

@廈冰 說的對,這么寫就可以了。

<style>
@media screen and (min-width: 1600px) {
  html {
    font-size: 100px;
  }
}
</style>
<style lang="scss" scoped>
.container {
  width: 100%;
  position: absolute;
  top: 43%;
  transform: translateY(-50%);
}
</style>
2017年12月18日 01:37
編輯回答
愚念

scope的沒辦法控制組件之外的的元素的屬性

2017年9月7日 10:01
編輯回答
悶油瓶

當前組件:

    <template>
        <div class="page"></div>
    </template>

添加scoped的話,你只能控制.page{width:100px;}及其內(nèi)部的樣式,像這種body,html需要在全局進行設(shè)置;并且你若是在全局樣式中寫了另一個.page{width:50px;},也會影響到當前頁面的.page

2017年6月6日 21:29