discuz内置常用CSS代码分析

CSS多IE下兼容HACK写法

所有 IE浏览器适用:.ie_all .foo { ... }
IE6 专用:.ie6 .foo { ... }
IE7 专用:.ie7 .foo { ... }
IE8 专用:.ie8 .foo { ... }

CSS书写规范

  1. 属性写在一行内,属性之间、属性名和值之间以及属性与“{}”之间须有空格,例如:.class { width: 400px; height: 300px; }
  2. 属性的书写顺序:
    1. 针对特殊浏览器的属性,应写在标准属性之前,例如:-webkit-box-shadow:; -moz-box-shadow:; box-shaow:;
    2. 按照元素模型由外及内,由整体到细节书写,大致分为五组:
      1. 位置:position,left,right,float
      2. 盒模型属性:display,margin,padding,width,height
      3. 边框与背景:border,background
      4. 段落与文本:line-height,text-indent,font,color,text-decoration,...
      5. 其他属性:overflow,cursor,visibility,...
  3. 谨慎添加新的选择符规则,尤其不可滥用 id,尽可能继承和复用已有样式
  4. 选择符、属性、值均用小写(格式的颜色值除外),缩写的选择符名称须说明缩写前的全称,例如 .cl -> Clearfix
  5. 勿使用冗余低效的 CSS 写法,例如:ul li a span { ... }
  6. 慎用 !important
  7. 建议使用在 class/id 名称中的词语
    1. 表示状态:a->active
    2. 表示结构:h->header,c->content,f->footer
    3. 表示区域:mn->main,sd->side,nv-navigation,mu->menu
    4. 表示样式:l-list,tab,p_pop

常用CSS

  • 左浮动、右浮动
.z { float: left; }
.y { float: right; }
  • 因为左右浮动造成的父级浮动溢出,及使用方法
.cl:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .cl { zoom: 1; }
  • 大标题字体
.wx, .ph { font-family: "Microsoft YaHei", "Hiragino Sans GB", STHeiti, Tahoma, SimHei, sans-serif; font-weight: 100; }
  • 行内分割竖线
.pipe { margin: 0 5px; color: #CCC; }
  • 文字字体大小
.xs0 { font-family: {SMFONT}; font-size: {SMFONTSIZE}; -webkit-text-size-adjust: none; }
.xs1 { font-size: 12px !important; }
.xs2 { font-size: 14px !important; }
.xs3 { font-size: 16px !important; }
  • 灰色文字
.xg1, .xg1 a { color: {LIGHTTEXT} !important; }
.xg1 .xi2 { color: {HIGHLIGHTLINK} !important; }
.xg2 { color: {MIDTEXT}; }
  • 高亮文字,1为橙色,2为蓝色
.xi1, .onerror { color: {NOTICETEXT}; }
.xi2, .xi2 a, .xi3 a { color: {HIGHLIGHTLINK} ; }
  • 文字粗体
.xw0 { font-weight: 400; }
.xw1 { font-weight: 700; }
  • 层下边线
.bbda { border-bottom: 1px dashed {COMMONBORDER}; }
.bbs { border-bottom: 1px solid {COMMONBORDER} !important; }
  • 去除边框
.bw0 { border: none !important; }
.bw0_all, .bw0_all th, .bw0_all td { border: none !important; }
  • 去除背景
.bg0_c { background-color: transparent !important; }
.bg0_i { background-image: none !important; }
.bg0_all { background: none !important; }
  • 外边距样式
.mtn { margin-top: 5px !important; }
.mbn { margin-bottom: 5px !important; }
.mtm { margin-top: 10px !important; }
.mbm { margin-bottom: 10px !important; }
.mtw { margin-top: 20px !important; }
.mbw { margin-bottom: 20px !important; }
  • 内边距样式
.ptn { padding-top: 5px !important; }
.pbn { padding-bottom: 5px !important; }
.ptm { padding-top: 10px !important; }
.pbm { padding-bottom: 10px !important; }
.ptw { padding-top: 20px !important; }
.pbw { padding-bottom: 20px !important; }
时间: 2024-08-03 18:32:34

discuz内置常用CSS代码分析的相关文章

python内置常用高阶函数(列出了5个常用的)

原文使用的是python2,现修改为python3,全部都实际输出过,可以运行. 引用自:http://www.cnblogs.com/duyaya/p/8562898.html https://blog.csdn.net/cv_you/article/details/70880405 python内置常用高阶函数: 一.函数式编程 •函数本身可以赋值给变量,赋值后变量为函数: •允许将函数本身作为参数传入另一个函数: •允许返回一个函数. 1.map()函数 是 Python 内置的高阶函数,

!!!常用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

!!!常用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

Visual Studio 内置快速生产代码简写集合

工作之余,整理了一下,Visual Studio 里面的快速生产代码缩写集合,这个拿出来分享想一下,希望对您有所帮助. 文件下载地址:VS内置生产代码缩写集合文档.rar 首字母 简写 生成代码 a attachedProperty public static readonly ??? propertyNameProperty = ???.RegisterAttached(     "propertyName",     typeof(propertyType),     typeof

Lucene中内置常用Query对象

以下这几种lucene内置查询对象,不过在实际的项目开发中,这种查询方式应用的不多.一般用QueryParser去获取查询对象.因为QueryParser内部基本实现了所有的内置查询对象. 这是最常见的QueryParse的写法 /** * 通过QueryParser去获取查询对象 * * @throws ParseException */ @Test public void searchByQueryParse() throws ParseException { // 1创建QueryPars

内置对象 arguments 的分析与使用

W3C 中说明: ECMAScript arguments 对象 可访问当前函数的参数,而无需指出参数名 区别于其他程序设计语言,ECMAScript 不会验证传递给函数的参数个数是否等于函数定义的参数个数 开发者定义的函数可以接受任意个数的参数(根据 NetScape 文档,最多可接受255个),而不会引发任何错误 任何遗漏的参数将以 undefined 传递给函数 可以模拟函数重载,如 function doAdd() { if(arguments.length == 1) { alert(

nginx内置常用变量

HTTP核心模块支持一些内置变量,变量名与apache里的对应.比如 $http_user_agent,$http_cookie等表示HTTP请求信息的变量. 更多变量: $args, 请求中的参数; $content_length, HTTP请求信息里的”Content-Length”; $content_type, 请求信息里的”Content-Type”; $document_root, 针对当前请求的根路径设置值; $document_uri, 与$uri相同; $host, 请求信息中

常用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

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-