常用CSS代码段

1.自定义文本选中样式(不支持IE8及以下)

::selection
{
color:#9400D3;
background:#A9A9A9;
}
::-moz-selection
{
color:#9400D3;
background:#A9A9A9;

}

2. 间隔与间距

  p.wordspacing{word-spacing:20px;}
/*  设置空格的长度*/
  p.letterspacing{letter-spacing:20px;}
/*  设置字间距*/
  p.lineheight{line-height:0.3;}
/*  设置行间距*/
  p.whitespace_normal{white-space:normal;}
/*  默认,忽略多个空格为1个,忽略回车符*/
  p.whitespace_pre{white-space:pre;}
/*  保留多个空格*/
  p.whitespace_nowrap{white-space:nowrap;}
/*  忽略回车符,禁止换行,直到遇到br*/
  p.whitespace_prewrap{white-space:pre-wrap;}
/*  保留所有空格符与回车符*/
  p.whitespace_preline{white-space:pre-line;}
/*  忽略多个空格为1个,保留回车*/

3. 文本装饰

/*文本线在上方*/
  .overline{text-decoration:overline;}
  /*文本线在下方*/
  .through{text-decoration:line-through;}
  /*文本线在中间*/
  .underline{text-decoration:underline;}
  /*斜*/
  .italic{font-style:italic;}
  /*倾斜*/
  .oblique{font-style:oblique;}

4. 文字超出父元素宽度,则省略号代替

  div.elli{
border:1px solid;
overflow:hidden; /*超出部分隐藏*/
white-space:nowrap;/*强制在一行显示*/
text-overflow:ellipsis;
width:200px;
height:20px;
}

//未完

时间: 2024-08-29 22:00:11

常用CSS代码段的相关文章

!!!常用CSS代码

.box{overflow:auto;zoom:1;} .box-in{display:inline-block;vertical-align:top;} .border-box{-webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;}/*ie8+*/ body,div,p,h1,h2,h3,h4,h5,h6{margin:0;padding:0;} (待补充) 清除浮动 <style

【cocos2dx 3.2】使用搜狗输入法短词,复用常用的代码段

引言: 在写cocos2dx代码的时候,发现有些代码是固定格式,经常要重用 故把它们不断收集起来,然后添加到搜狗输入法的短词里面 这样需要重用的时候,直接输快捷键,效率就提高了 把常用的代码段收集起来,做成一个CHM文档方便设置短词时查阅 搜狗输入法添加短词: 右键搜狗输入法,点击[设置属性] 选择[高级],然后选择右边的[自定义短语设置] 点击[添加新定义],添加自己的快捷键和代码段 常用的代码段(不断更新) 新建一个类的时候,需要写create方法和init方法,快捷键设为cre //创建c

!!!常用CSS代码块

图片排满一行.左右两端无间隙. <style type="text/css"> .img_abc{float:left;width:30%;margin-left:5%;} .img_abc:first-child{margin-left:0} .body92{margin-left:4%;margin-right:4%;} </style> <div class="body92"> <img src="14085

常用JS代码段

1.表单文本框的focus 1 va($('input[type=text]')); 2 function va(a) { 3 for(var i=0;i < a.length; i++){ 4 var $txt= a.eq(i); 5 $txt.focus(function(){ 6 if($(this).val() == this.defaultValue){ 7 $(this).val(''); 8 } 9 }); 10 $txt.blur(function(){ 11 if($(this

常用CSS代码片段

1.标准html页面模板 <!DOCTYPE html> <html lang="zh-cn"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="wid

discuz内置常用CSS代码分析

CSS多IE下兼容HACK写法 所有 IE浏览器适用:.ie_all .foo { ... } IE6 专用:.ie6 .foo { ... } IE7 专用:.ie7 .foo { ... } IE8 专用:.ie8 .foo { ... } CSS书写规范 属性写在一行内,属性之间.属性名和值之间以及属性与“{}”之间须有空格,例如:.class { width: 400px; height: 300px; } 属性的书写顺序: 针对特殊浏览器的属性,应写在标准属性之前,例如:-webkit

CSS常用的代码段

1.CSS RESET 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, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, cente

CSS大全_最全的常用css代码

字体属性:(font)大小 {font-size: x-large;}(特大) xx-small;(极小) 一般中文用不到,只要用数值就可以,单位:PX.PD样式 {font-style: oblique;}(偏斜体) italic;(斜体) normal;(正常)行高 {line-height: normal;}(正常) 单位:PX.PD.EM粗细 {font-weight: bold;}(粗体) lighter;(细体) normal;(正常)变体 {font-variant: small-

几个实用的CSS代码段总结

废话不多说,直接上代码,希望能帮到有需要的小伙伴 ①:遮罩 position: fixed; background: rgba(0, 0, 0, .4); top: 0; left: 0; right: 0; bottom: 0; z-index: 99; width: 100%; height: 100%; ②:三角(下面三角的代码按照下图上右下左的顺序排列) width: 0; height: 0; border-width: 8px; border-style: solid; border