百度面試碰到的題,要實現以下佈局效果面試
flex: 0 1 auto (自適應)bash
text-overflow:ellipsis;(自動省略文字)佈局
overflow:hidden;字體
white-space: nowrap;flex
完整的代碼以下spa
// CSS 部分
.container {
display: flex;
}
.pic {
width: 100px;
height: 100px;
border-radius: 50%;
background-color: pink;
}
.name {
flex:0 1 auto;
height: 100px;
background-color: purple;
text-overflow:ellipsis;
overflow:hidden;
white-space: nowrap;
}
.tag {
width: 100px;
height: 100px;
text-align: center;
line-height: 100px;
background-color: seagreen;
}
複製代碼
// HTML 部分
<div class="container">
<div class="pic"></div>
<div class="name">
zhasansndfdkfnald
</div>
<div class="tag">設計師</div>
</div>
複製代碼