So what I want is to have a horizontal line on the right side of my p
element, so I applied a border-bottom: 1px solid black
to p::after
, like this
(The elements' outline
in red
, blue
, and green
are for debugging and are not part of the final design)
div {
position: relative;
height: 100%;
width: 100%;
outline: 1px solid red;
}
p {
transform: rotate(-90deg);
display: flex;
flex-direction: row;
outline: 1px solid blue;
}
p::after {
content: "";
flex: 1 1;
border-bottom: 1px solid black;
margin: auto;
margin-left: 10px;
outline: 1px solid green;
}
<div>
<p>Text here!</p>
</div>
The code above works fine and it achieves what I want.
...however, if I want to move the p
tag using position: absolute
, the line disappears (see the snippet below). How can I work around this?
div {
position: relative;
height: 100%;
width: 100%;
outline: 1px solid red;
}
p {
transform: rotate(-90deg);
display: flex;
position: absolute;
top: 50%;
left: 50%;
outline: 1px solid blue;
}
p::after {
content: "";
flex: 1 1;
border-bottom: 1px solid black;
margin: auto;
margin-left: 10px;
outline: 1px solid green;
}
<div>
<p>Text here!</p>
</div>
` should look like - please post a sample image or mock-up that shows us what you want to see.
– Dai Jun 07 '22 at 12:47