我想添加一個覆蓋整個頁面的背景圖片。然而,這是現在的樣子:我正在嘗試添加背景圖片到我的vue.js項目
我希望它橫跨整個網頁。這將如何在vue.js中完成?
我也想要一個動畫工具欄,以便當頁面不滾動時,工具欄是透明的,並且看起來像背景圖像。當滾動工具欄將有目前的藍色
這裏是我的小提琴
這是HTML
<template>
<div id = "background">
<div class = "" id = "explain">
<h1 class = "md-title">{{ message }}</h1>
<h3> Collect, analyse and do better with data!</h3>
</div>
<hr>
<md-layout id = "container">
<md-layout md-flex-xsmall="100" md-flex-small="100" md-flex-medium="100" md-flex-large="100" md-flex-xlarge="100">
<span class="md-headline">HOW does levi function ?</span>
</md-layout>
<md-layout md-flex-xsmall="100" md-flex-small="100" md-flex-medium="100" md-flex-large="100" md-flex-xlarge="100">
<h3>levi uses research and experimentation to provide
'actionable knowledge' that you can use to <b>do well </b>in your environment. </h3>
</md-layout>
<md-layout md-flex-xsmall="100" md-flex-small="100" md-flex-medium="33" md-flex-large = "33" md-flex-xlarge = "33">
<h4> Identify and Collect what is needed</h4>
</md-layout>
<md-layout md-flex-xsmall="100" md-flex-small="100" md-flex-medium="33" md-flex-large = "33" md-flex-xlarge = "33">
<h4> Organize and analyse the evidence</h4>
</md-layout>
<md-layout md-flex-xsmall="100" md-flex-small="100" md-flex-medium="33" md-flex-large = "33" md-flex-xlarge = "33">
<h4>Communicate and act on the evidence! </h4>
</md-layout>
</md-layout>
<md-layout id = "Identity">
<md-layout md-flex-xsmall="100" md-flex-small="100" md-flex-medium="100" md-flex-large="100" md-flex-xlarge="100">
<span class="md-headline"> HOW do we exist?</span>
</md-layout>
<md-layout md-flex-xsmall="100" md-flex-small="100" md-flex-medium="100" md-flex-large="100" md-flex-xlarge="100">
Our team realized that many institutions are unable to deconstruct their environment and respond to its need because; they do not have the
cost effective products, proper processes , and the necessary execution techniques required to do so.
<p>levi has been built to provide the platform and process necessary to help those in need <b>do well.</b></p>
</md-layout>
<md-layout md-flex-xsmall="100" md-flex-small="100" md-flex-medium="100" md-flex-large="100" md-flex-xlarge="100">
<span class="md-headline">WHAT do we do?</span>
</md-layout>
<md-layout md-flex-xsmall="100" md-flex-small="100" md-flex-medium="100" md-flex-large="100" md-flex-xlarge="100">
Our community combines products and processes to augment human intelligence, reduce waste, and provide wellbeing.
</md-layout>
<md-layout md-flex-xsmall="100" md-flex-small="100" md-flex-medium="100" md-flex-large="100" md-flex-xlarge="100">
<span class="md-headline"></span>
</md-layout>
<md-layout md-flex-xsmall="100" md-flex-small="100" md-flex-medium="100" md-flex-large="100" md-flex-xlarge="100">
</md-layout>
</md-layout>
</div>
</template>
這是CSS
<style scoped>
h1 {
font-family: Helvetica neue;
text-align: center;
font-weight: 400;
font-size: 49px;
line-height: 1.1em;
font-family: Heiti SC;
}
h2 {
font-family: Helvetica neue;
text-align: center;
font-weight: 600;
font-size: 19px;
}
h3 {
font-family: Helvetica neue;
text-align: center;
font-weight: 300;
font-size: 19px;
}
h4 {
font-family: Helvetica neue;
text-align: center;
font-weight: 300;
font-size: 19px;
}
#Identity > .md-layout {
/*background-color: lightgrey;*/
border-color: black;
align-items: center;
justify-content: center;
/*border-style: dotted;*/
border-width: 1px;
padding: 8px;
font-weight: 200;
font-size: 20px;
line-height: 1.4em;
}
span {
font-family: Helvetica neue;
}
這是用於渲染背景的css語法。
#background { background: url(../../assets/whiteCoffeedarken.jpg); }
#container > .md-layout {
/*background-color: lightgrey;*/
border-color: black;
align-items: center;
justify-content: center;
/*border-style: dotted;*/
border-width: 1px;
padding: 8px;
}
</style>
這與Vue無關。 – ceejayoz
@ceejayoz你是什麼意思? –
'background-size:cover;' –