小编mik*_*ike的帖子

很难在 Vue js 中更改背景颜色

我正在尝试将登陆页面的背景颜色设置为橙色,但问题是我目前拥有的所有页面都是橙色的。

我尝试添加scoped到登录页面,以便它只设置该页面的样式,但是当我这样做时,整个页面不再是橙色。

最终目标是只影响着陆页。

我已经尝试过 HTML 和 Body 而不是 ' * ',这些在这种情况下也不起作用。

landingpage.vue

<template>
    <div class="container">
        <div class=landing>
            <h1>Hello.</h1>
            <router-link to="/work">
                <button id="work" type="button">See my work</button>
            </router-link>
            <router-link to="/home">
                <button id="home" type="button">Go home</button>
            </router-link>
        </div>
    </div>
</template>

<script>
export default {
  name: 'Landing',
};
</script>

<style scoped>
* {
    background: orange;
}

h1 {
    margin-top: 100px;
    text-align: center;
    font-size: 80px;
    color: green;
}
#work {
    color: green;
    border: none;
    font-size: 25px;
    text-decoration: none;
    margin: 0;
    position: absolute;
    top: …
Run Code Online (Sandbox Code Playgroud)

javascript css vue.js

6
推荐指数
1
解决办法
911
查看次数

标签 统计

css ×1

javascript ×1

vue.js ×1