I have some html code like this on JSFiddle:
<!-- index.html -->
<div id="my_container">
<p id="my_title">這是中文</p>
<div id="my_mark"></div>
<p id="my_text">2022-12-08 13:15</p>
</div>
and here’s the css code of the above html:
#my_container {
height: 200px;
display: flex;
flex-direction: column;
align-items: center;
position: absolute;
top: 70%;
}
#my_title {
text-align: center;
}
#my_mark {
width: 20px;
height: 20px;
background-color: red;
border-radius: 50%;
margin-top: -45px;
margin-bottom: -10px;
}
.my_text {
text-align: center;
width: 200px;
}
Currently, it displays my_title
, my_mark
, and my_text
in this way:
How can I move the Chinese characters to the upper part the the red circle, and display them vertically?
Here’s the result that I’d like to achieve.
How can I set some properties to my_title
so that it displays vertically and stays at the top of the red circle?
2
Answers
You can just set the
writing-mode
property tovertical-rl
Here is the full code:
I did some small changes in the div, so it can show the result as you want.
You can easily do that by setting the width to be 20px, for the text.