I have p
tags within a div
that is wider than it is high. One of the p
has the writing mode set to vertical-rl
. Although the text does wrap much of the text is clipped. It looks like the height of the vertical-rl
p
matches the width of the div
so when it’s rotated some of it is beyond the div
.
My Code:
div {
position: absolute;
border: 1px dotted red;
left: 10px;
top: 10px;
height: 200px;
width: 300px;
overflow: hidden;
}
p {
font-family: Georgia, serif;
font-size: 18px;
}
.vertical-rl {
writing-mode: vertical-rl;
color: #0074d9;
}
<div>
<p>This is text that needs to be read from top to bottom, and from left to right.</p>
<p class="vertical-rl">This is text that needs to be read from top to bottom, and from right to left.</p>
</div>
I have tried setting block-size and inline-size but I can’t get the text to not be clipped. How can I have vertical-rl text wrap early enough that it doesn’t overflow its container?
2
Answers
You can give the p a max-height
You could calculate it too needed
One way would be to make the container a grid, so giving the second paragraph defined space: