CSS
cwxblog
There's a phrase in Buddhism, 'Beginner's mind.' It's wonderful to have a beginner's mind.Stay hungry,stay foolish.
展开
-
css处理单行,多行文本溢出
单行文本溢出p { overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}多行文本溢出p { position: relative; line-height: 1.5em; /*高度为需要显示的行数*行高,比如这里我们显示两行,则为3*/ height: 3em; overflow: hidden;}p:after { content: '...'; position: abso原创 2021-07-28 16:53:38 · 319 阅读 · 0 评论 -
css居中布局总结:水平居中,垂直居中,水平垂直居中
1. 水平居中:①.被设置元素为行内元素,设置父元素:text-aligen:center;②.被设置元素为块状元素,元素定宽时:margin:0px(可变) auto; 元素不定宽时:display:inline;text-aligne:center;③.通过给父元素设置 float,然后给父元素设置 position:relative 和 left:50%,子元素设置 position:relative 和 left: -50% 来实现水平居中。④.通过flex布局,设置父元原创 2017-07-05 17:13:38 · 266 阅读 · 0 评论