我最近在一家视听公司开始了一份新工作,他们要求我开发一个应用程序,允许用户(无需身份验证)将图像上传到显示页面并自动滚动浏览。
我选择了唯一一个我觉得有用的旋转木马,但我的问题是横向图像没有与纵向图像垂直对齐。
我的代码设置为将上传的图像发送到数据库,然后检索并自动显示在轮播中,因此每张图像都有自己的单独 div 标签。
页面本身在没有数据库连接的情况下不会加载,并且由于其中的 PHP 元素而无法在 JSFiddle 中工作。
这里还有我的问题的截图:
Image 1 displaying portrait image at full height
Image 2 displaying landscape image at top of the page
我希望图像 2 显示在页面中央,但在我寻找正确信息的所有地方似乎都找不到我要找的东西。
请帮助我,我将不胜感激!
AlexJamesDean。
最佳答案
你可以给图片div添加位置
.autoplay{position: relative;}
#img_div {
width: auto;
height: auto;
postion: absolute;
top: 50%;
transfrom: translateY(-50%);
}
关于php - Slick Carousel 中的垂直对齐图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41717390/