html - 老虎机的 CSS 流体布局问题
问题描述
所以我正在尝试创建一个简单的老虎机。首先,我在身体上有一个随机的背景图像,然后我有一个老虎机本身的 div。在老虎机的 div 内有一个包装 div,其中包含 3 个 div,每个 div 都有一个带有插槽编号的背景图像。图像有大约 2000 像素的高度和 Y 轴上的背景重复,以创造插槽无限旋转的印象。我用来隐藏溢出的包装器 div 但是当我试图使插槽流动时,我在将包装器 div 与老虎机本身的数字对齐时遇到了一些麻烦。希望你们明白我想要做什么。我将分享代码和两个屏幕截图。如果需要,我也可以上传图片。
尝试使用包装器的宽度,但无法到达我想要的位置。
<body>
<div class="slot-machine">
<div class="wrapper">
<div class="slot-strip"></div>
<div class="slot-strip"></div>
<div class="slot-strip"></div>
</div>
</div>
</body>
* {
margin:0;
padding:0;
border:0 none;
box-sizing: border-box;
}
html,body {
width:100%;
height:100%;
}
body {
background:url("bg.jpg");
background-size: cover;
padding:300px 0;
}
.slot-machine {
background:url("slot-machine.png");
background-repeat: no-repeat;
background-position:center;
margin:auto;
width:1200px;
height: 240px;
overflow: hidden;
}
.wrapper {
float:left;
width:330px;
height:120px;
margin-left:440px;
margin-top:75px;
overflow: hidden;
background:rgba(0,0,0,0.5);
}
.slot-strip {
background:url("slot-strip.png");
width:110px;
height:2000px;
background-size: contain;
float:left;
background-position: 0 110px;
}
@media only screen and (max-width: 1250px) {
.slot-machine {
width:98%;
background-size: contain;
}
.wrapper {
}
}
老虎机和老虎机号码应该一起减小。
解决方案
推荐阅读
- c++ - C++ 中的分段错误(特征库)
- angular - 最新版本的故事书不适用于 Angular2+ 项目
- r - 在闪亮的应用程序中同时显示多个范围的数据表行
- javascript - 带有php的javascript代码不起作用
- spring-boot - 使用 Spring Batch 将多个 CSV 文件加载到数据库中
- php - 没有模板的重定向?
- reactjs - React 日期选择器使用较旧的 React 版本
- r - Lodown 更新 NPPES NPI 提取
- c# - PDFsharp - 导入 PdfDocument 对象;连接页面
- c++ - 类模板忽略的用户定义的转换运算符(非模板则不然)