Bakira
1
Hi all,
I have a html.P component which looks like this:
htm.P("Text | ABC")
I want, that the text before the vertical bar is colored in red. I tried this
html.P("Text | ABC", className="red-text::before")
with the style.css file:
.red-text::before {
content: " | ";
color: rgb(255, 0, 0);
}
But the text color will not change. Any idea?
AIMPED
2
Hi @Bakira Iām not an CSS specialist, but I think the before/after does not work like this.
It seems, that you want to use it as some kind of regex.
I would use a html.Span()
stack:
html.P([
html.Span("Text", className="classOne"),
html.Span(" | "),
html.Span("ABC", className="classTwo"),
])
css:
.classOne {
color: red;
}
.classTwo {
color: blue;
}
2 Likes
Bakira
3
Hi @AIMPED,
you are fully right. My initial idea was wrong.
With your suggestion it works even better since its more customizable.
Thanks!
1 Like