z-index не работает, в чем ошибкa, last_child
Всем привет, не получается правильно вставить салотовый уголок в блоках, в чем проблема не пойму помогите разобратся, вот я пробывала через
content: '';
display: block;
background-image: url("storage/app/public/default/Path15.png");
width: 6px;
height: 11px;
z-index: -1;
}
также пробовала через создание нового блока не работает, также надо чтобы он был на двоих из шести этих div. КАк сделать подскажите пожалуйста, спасибо
<section class="sect-services">
<div class="container">
<div class="row">
<div class="col-md-4 col-sm-4" >
<div class="service-item">
<div class="service-item-image">
<img src="{{url('/storage/'.$service->images)}}" alt="Ceramic">
</div>
<h4>{{$service->name}}</h4>
<p class="mb-0 text-muted">{!! strip_tags($service->content) !!}</p>
<div class="service-item-price">
<a href="{{$service->url}}" class="button">Zobacz więcej</a>
</div>
</div>
</div>
</div>
</div>
</section>
.sect-services{
.col-md-4{
bottom: 72px;
}
}
.service-item{
box-shadow: rgba(224, 218, 218) 0 14px 19px;
transition: all .5s ease;
text-align: center;
padding-bottom: 5px;
margin: 14px 0px;
border-radius: 24px;
&::before {
content: '';
display: block;
background-image: url("storage/app/public/default/Path15.png");
width: 6px;
height: 11px;
z-index: -1;
}
&:hover{
transform: scale(1.05);
border-color: $main-color;
box-shadow: rgba(0, 0, 0, .25) 0 0 22px;
.service-stars{
.fa{
margin: 0 3px;
}
}
.service-item-image{
.fa{
opacity: .4;
}
&::before{
opacity: .7;
}
}
}
h4{
font-family: $heading-body-font-family;
font-size: 28px;
margin-bottom: 18px;
font-weight: 700;
}
p{
font-size: 18px;
text-align: center;
font-family: $body-font-family;
padding: 0 29px;
}
.service-stars{
font-size: 11px;
color: black;
.fa{
margin-left: 1px;
transition: all .5s ease;
}
}
.service-item-image {
min-height: 160px;
background-size: cover;
position: relative;
bottom: 22px;
img{
width: 180px;
}
.fa{
font-size: 30px;
color: $accent-color;
position: absolute;
top:50%;
left: 50%;
margin-left: -10px;
margin-top: -10px;
opacity: 0;
transition: all .5s ease;
}
&::before {
position: absolute;
content: '';
width: 100%;
height: 100%;
top: 0;
left: 0;
//background-color: $main-color;
opacity: .0;
transition: 0.5s ease;
}
&:hover{
transform: scale(1.05);
.service-item-image{
.fa{
opacity: .4;
}
&::before{
opacity: .7;
border-radius: 24px;
}
}
}
}
.service-item-price{
margin-bottom: 26px;
margin-top: 22px;
font-size: 19px;
font-family: $heading-font-family;
span{
font-size: 30px;
}
.fa{
color: $main-color;
font-size: 18px;
}
.button{
background-color: transparent !important;
box-shadow: none !important;
color: #42525F !important;
border: 2px solid #CFD3D7 ;
text-align: left;
font-family: $button-body-font-family;
font-size: 18px;
position: initial;
padding: 11px 26px;
&:hover {
background-color: transparent;
box-shadow: none;
background-image: none;
}
}
}
}
Ответы (2 шт):
Ты можешь сделать что-то на подобие этого -
html
<div id="last-div">
Posledniy div s kontentom
</div>
<div id="green-corner">
<img src="corner.png">
</div>
css
#last-div{
position: relative;
width: 100px;
height: 100px;
}
#green-corner{
position: absolute;
top: -10px; /* -razmer zelenogo prostranstwa slewa kartinki */
left: 90px; /* razmer last-div - razmer pustogo prostranstwa snizu kartinki */
}
Не самое оптимальное решение, но другого я пока не знаю. Надеюсь поможет.
z-index работает в связке с таким свойством как position.
В вашем примере отсутствует position, следовательно имеет значение по-умолчанию - static
static
Это значение позволяет элементу находиться в обычном его состоянии, расположенном на своем месте в документе. Свойстваtop,right,bottom,leftиz-indexне применяются к данному элементу. Это значение по умолчанию.