html界面背景图片不显示,我想知道应该怎么改?

<style type="text/css">
*{
background-image:url("../image/4.jpg");
background-repeat:no-repeat;
background-size:100%,100%;
}
</style>
<body>
<div align="center" style="position: relative;top:200px">
<input type="button" value="管理员登录"onclick="javascrtpt:location.href='http://localhost:8080/18033212/admin/a_denglu.jsp'">
<input type="button" value="学生登录"onclick="javascrtpt:location.href='http://localhost:8080/18033212/student/s_denglu.jsp'">
<input type="button" value="教师登录"onclick="javascrtpt:location.href='http://localhost:8080/18033212/teacher/t_denglu.jsp'">
</div>
</body>

第1个回答  2020-06-25
<style type="text/css">
html,body {
width:100%;
height:100%;
background:url("../image/4.jpg") no-repeat center center / 100% 100%;
}
</style>本回答被网友采纳
第2个回答  2020-06-27
错误在:没有给body,html设置大小,background-image显示不了
body,html{
width:100%;
height:100vh;//整屏高,或者100%;
//再把你的background 样式写在里面
}
相似回答