What is the problem of text overflow caused by vertical arrangement of flex align-items:center?

if I set align-items:center, it will cause text overflow. What is the cause of this?

html

<div class="box">
    <div></div>
    

<span>hello word</span> </div>

css

.box{
    width:200px;
    height:200px;
    display:flex;
    flex-direction:column;
      
    align-items:center; /*   */
    
    border:1px solid red;
    margin:50px;
    box-sizing:border-box;
    padding:10px;
}
.box p{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

clipboard.png

jsfiddle: https://jsfiddle.net/ea54ds3v/3/

Mar.15,2022

if you write the style of p to show an ellipsis when you want to overflow, then you can add
max-width: 100% to the style of p;
where p is too long is the content overflow of box, not the content overflow of p, so the style added to p is not shown.


your text will definitely overflow if it exceeds the width of the box, unless you set overflow-x:scroll;

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e99ece-47550.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e99ece-47550.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?