css中文英文换行、禁止换行、显示省略号


css中文英文换行

1  word-break:break-all;只对英文起作用,以字母作为换行依据 2  word-wrap:break-word; 只对英文起作用,以单词作为换行依据 3  white-space:pre-wrap; 只对中文起作用,强制换行 4 white-space:nowrap; 强制不换行,都起作用 5 white-space:nowrap; overflow:hidden; text-overflow:ellipsis;不换行,超出部分隐藏且以省略号形式出现

 

css 省略号

.text2 { width:200px; word-break:break-all; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden;
}

 

img 图片盒子内垂直水平居中

.offer_img { height: 100%; width: 100%; text-align: center; vertical-align: middle; padding: 0.2rem; img{ max-width: 100%; max-height: 100%; display: inline;
    } } .offer_img:after { content: ""; display: inline-block; height: 100%; vertical-align: middle; width: 0;
}

 

清除浮动

.clearfix:before, .clearfix:after, { content: ""; display: table; } .clearfix:after { clear: both; } .clearfix { *zoom: 1; }

 

css 初始化reset.css

/** * Eric Meyer's Reset CSS v2.0 (http://meyerweb.com/eric/tools/css/reset/) * http://cssreset.com */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, menu, nav, output, ruby, section, summary, time, mark, audio, video, input { margin: 0; padding: 0; border: 0; font-size: 100%; font-weight: normal; vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */ article, aside, details, figcaption, figure, footer, header, menu, nav, section { display: block;
} body { line-height: 1;
} blockquote, q { quotes: none;
} blockquote:before, blockquote:after, q:before, q:after { content: none;
} table { border-collapse: collapse; border-spacing: 0;
}

/* custom */ a { color: #7e8c8d; text-decoration: none; -webkit-backface-visibility: hidden;
} li { list-style: none;
} ::-webkit-scrollbar { width: 5px; height: 5px;
} ::-webkit-scrollbar-track-piece { background-color: rgba(0, 0, 0, 0.2); -webkit-border-radius: 6px;
} ::-webkit-scrollbar-thumb:vertical { height: 5px; background-color: rgba(125, 125, 125, 0.7); -webkit-border-radius: 6px;
} ::-webkit-scrollbar-thumb:horizontal { width: 5px; background-color: rgba(125, 125, 125, 0.7); -webkit-border-radius: 6px;
} html, body { width: 100%;
} body { -webkit-text-size-adjust: none; -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
View Code

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM