javascript - CSS:背景img不居中
问题描述
当我打开 HTML 文件时,背景 img 居中,但将文件上传到 Wordpress 后,背景居中在屏幕右侧。我不知道问题可能是什么。
这是代码
body {
line-height: 1;
background:url(images/shopbg.png);
background-repeat: no-repeat;
background-attachment: fixed;
background-size: 80%;
background-position: center center;
background-color: black;
解决方案
您的样式应用于<body>
标签,当您上传文件时,您可能有其他 css 文件,其类位于<body>
. 您可以为您的元素创建一个特定的类并在那里应用样式。
推荐阅读
- asp.net - 无法在 Azure 中编辑或删除 .svc。找不到错误 404
- r - 从 R 中的一组局部最大值中获取真正的最大值
- jwt - Keycloak权限信息产品ID
- angular - 将 Spotify 曲目添加到播放列表会返回 401
- reactjs - 在 React 中将 props 传递给组件
- html - 你如何在 Vue 中使用 input type="image"?
- r - r- 使用 sum 和 match 查找高频的第一次出现
- json - 将对象转换为键值对数组
- python - 如何删除通过 pyenv/pip 安装的包
- sas - PROC SGPLOT中curvelabelpos和xaxis的SAS问题