I am using a display:list-item for the div pseudo-element::before. We can style the shape of the marker either disc or square…
.calendar{
display: block;
position: relative;
width: 100px;
aspect-ratio: 1;
background-color: green;
}
.calendar::before{
content:"Reserved";
display: list-item;
position: absolute;
bottom: 0;
right: -100%;
color: black;
list-style-type: disc; /* or list-style-type: square; */
}
<div class="calendar"></div>
Can we change the color of marker without changing the content color (without using list-style-image)?
2
Answers
Not as you have it, pseudo-elements can’t have pseudo-elements (like
::marker
) as would be required here.Swap out the pseudo-element for a
span
instead.You can use an image but without introducing a real image. A gradient can do the job: