I have this problem that there is a border around the text when stacking that same word over itself. you see I'm trying to color diacritical marks in Arabic like "كتب" vs "كُتُب" there is no direct way to do that. so I write the text twice one with the diacritical marks and the other without, then stack them together just like in container1:
body,
* {
padding: 0;
margin: 0;
margin-top: 20px;
}
div {
position: relative;
height: 200px
}
div p {
position: absolute;
top: 0;
left: 0;
font-size: 100px;
font-weight: 600;
}
.container1 p.colored {
color: red;
z-index: 1;
}
.container1 p.base {
color: #000;
z-index: 2;
}
/* container2 */
.container2 p.base {
color: #000;
z-index: 2;
}
/* container3 */
.container3 p.colored {
color: blue;
z-index: 1;
}
.container3 p.base {
color: #000;
z-index: 2;
}
/* container4 */
.container4 p.colored {
color: green;
z-index: 1;
}
.container4 p.base {
color: #000;
z-index: 2;
}
<!DOCTYPE html>
<html lang="ar" dir="rtl">
<head>
</head>
<body>
<div class="container1">
<p class="colored">
كُتُب
</p>
<p class="base">
كتب
</p>
</div>
<div class="container2">
<p class="base">
كُتُب
</p>
</div>
<div class="container3">
<p class="colored">
كُتُب
</p>
<p class="base">
كُتُب
</p>
</div>
<div class="container4">
<p class="colored">
كُتُب
</p>
<p class="base">
كُتُب
</p>
</div>
</body>
</html>
but if you can see there is a border to the text in container1 with the color red. if you can't see it try changing the color from the devtool with the color Picker. how can I prevent this effect? thanks note that i can't change the font weight of the colored paragraph.