<template>
<div id="logo">
</div>
</template>
<script>
import meadiaurl from '../../api/mediaurl'
export default {
name: "logo"
</script>
<style scoped>
#logo{
background: url("../../assets/images/Login.png");
background-size: 100% 100%;
height: 100%;
}
</style>
如果像以上代碼寫,高度為100%時,會發現背景圖片只是內容撐起來的,卻不能使整個屏幕鋪滿背景圖;
解決方案:
我們要讓#logo脫離文檔流,為他添加個fixed屬性
#logo{
background: url("../../assets/images/Login.png");
background-size: 100% 100%;
height: 100%;
position: fixed;
width: 100%
}
以上是本章全部內容