带有定制卡的Carousel carousel
试图将carousel用卡片使用而不是仅仅图像使用(例如图像在左侧,文本位于卡的右侧),锚标签“ < a class =“ carousel-item”> gt;
“正在解决问题,我将其删除,我的卡状态正确,但无法移动卡,当我将其保留时,它将图像从卡片中取出并弄乱了。
/*materializecss*/
.carousel {
overflow: hidden;
position: relative;
width: 100%;
height: 400px;
perspective: 500px;
transform-style: preserve-3d;
transform-origin: 0% 50%; }
.carousel.carousel-slider {
top: 0;
left: 0; }
.carousel.carousel-slider .carousel-fixed-item {
position: absolute;
left: 0;
right: 0;
bottom: 20px;
z-index: 1; }
.carousel.carousel-slider .carousel-fixed-item.with-indicators {
bottom: 68px; }
.carousel.carousel-slider .carousel-item {
width: 100%;
height: 100%;
min-height: 400px;
position: absolute;
top: 0;
left: 0; }
.carousel.carousel-slider .carousel-item h2 {
font-size: 24px;
font-weight: 500;
line-height: 32px; }
.carousel.carousel-slider .carousel-item p {
font-size: 15px; }
.carousel .carousel-item {
visibility: hidden;
width: 200px;
height: 200px;
position: absolute;
top: 0;
left: 0; }
.carousel .carousel-item > img {
width: 100%; }
.carousel .indicators {
position: absolute;
text-align: center;
left: 0;
right: 0;
bottom: 0;
margin: 0; }
.carousel .indicators .indicator-item {
display: inline-block;
position: relative;
cursor: pointer;
height: 8px;
width: 8px;
margin: 24px 4px;
background-color: rgba(255, 255, 255, 0.5);
transition: background-color .3s;
border-radius: 50%; }
.carousel .indicators .indicator-item.active {
background-color: #fff; }
.carousel.scrolling .carousel-item .materialboxed,
.carousel .carousel-item:not(.active) .materialboxed {
pointer-events: none; }
/*custom css*/
.imp-card {
width: 400px;
height: 300px;
display: flex;
justify-content: center;
}
.image-section {
width: 200px;
}
.pic-imp-layout {
width: 100%;
height: 100%;
}
.text-section {
width: 200px;
text-align: right;
padding-right: 10px;
}
<div class="carousel">
<a class="carousel-item">
<div class="imp-card">
<div class="image-section">
<img class="pic-imp-layout" src="{% static 'images/img.jpg' %}">
</div>
<div class="text-section">
<p class="score">Score</p>
<p class="description"><a>“</a> lorel ipsum<a>”</a></p>
<p class="author">- John</p>
<div class="like"></div>
</div>
</div>
</div>
</a>
</div>
trying to use materializecss carousel with cards instead of just images [such that image is to the left and texts are to the right side of the card], the anchor tag "<a class="carousel-item">
" is making the problem, I remove it and my card is in proper shape but then not able to move the cards around, when I keep it in, it takes the images out of the cards and messes up.
/*materializecss*/
.carousel {
overflow: hidden;
position: relative;
width: 100%;
height: 400px;
perspective: 500px;
transform-style: preserve-3d;
transform-origin: 0% 50%; }
.carousel.carousel-slider {
top: 0;
left: 0; }
.carousel.carousel-slider .carousel-fixed-item {
position: absolute;
left: 0;
right: 0;
bottom: 20px;
z-index: 1; }
.carousel.carousel-slider .carousel-fixed-item.with-indicators {
bottom: 68px; }
.carousel.carousel-slider .carousel-item {
width: 100%;
height: 100%;
min-height: 400px;
position: absolute;
top: 0;
left: 0; }
.carousel.carousel-slider .carousel-item h2 {
font-size: 24px;
font-weight: 500;
line-height: 32px; }
.carousel.carousel-slider .carousel-item p {
font-size: 15px; }
.carousel .carousel-item {
visibility: hidden;
width: 200px;
height: 200px;
position: absolute;
top: 0;
left: 0; }
.carousel .carousel-item > img {
width: 100%; }
.carousel .indicators {
position: absolute;
text-align: center;
left: 0;
right: 0;
bottom: 0;
margin: 0; }
.carousel .indicators .indicator-item {
display: inline-block;
position: relative;
cursor: pointer;
height: 8px;
width: 8px;
margin: 24px 4px;
background-color: rgba(255, 255, 255, 0.5);
transition: background-color .3s;
border-radius: 50%; }
.carousel .indicators .indicator-item.active {
background-color: #fff; }
.carousel.scrolling .carousel-item .materialboxed,
.carousel .carousel-item:not(.active) .materialboxed {
pointer-events: none; }
/*custom css*/
.imp-card {
width: 400px;
height: 300px;
display: flex;
justify-content: center;
}
.image-section {
width: 200px;
}
.pic-imp-layout {
width: 100%;
height: 100%;
}
.text-section {
width: 200px;
text-align: right;
padding-right: 10px;
}
<div class="carousel">
<a class="carousel-item">
<div class="imp-card">
<div class="image-section">
<img class="pic-imp-layout" src="{% static 'images/img.jpg' %}">
</div>
<div class="text-section">
<p class="score">Score</p>
<p class="description"><a>“</a> lorel ipsum<a>”</a></p>
<p class="author">- John</p>
<div class="like"></div>
</div>
</div>
</div>
</a>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到了解决问题的课程,poleterizecss类的预定高度和宽度会创建问题,父自定义卡,并且该类应该具有相同的分辨率,并且也不能在DIV的先前存在的锚定标签中使用锚定标签,一切正常。
found the class that was making the issue, the predetermined height and width of Materializecss class creates the issue, parent custom card and this class should have the same resolution and also can't use anchor tags inside the pre-existing anchor tag of the div, and everything is working normally.