垂直居中:
           先height再ling-height,都设成一样高

span 垂直居中:vertical-align:50%
设置外边距:
           margin-top,margin-left,margin-right,margin-bottom
div背景单张铺满设置:
           width: 30px;
           height: 30px;
           line-height: 30px;
           background-image: url(../image/lzhf/one.png);
           background-repeat: no-repeat;
           background-size: 100% auto;

div浮在div上:
           <div style="position: relative;height: 30px;width: 100%">
              <div style="height: 30px; overflow: hidden;position: absolute;z-index: 2;width: 100%;">
                  <img alt="主要职责" style="width: 100%; height: 30px;"
                      src="../../image/ljfy/zcjgtop.png">
              </div>

<div style="position: absolute;z-index: 3;margin-left:10px;height: 30px;line-height: 30px;">
                  <img src="../../image/ljfy/zyzzc.png" width="30" height="30">
              </div>
              <div style="position: absolute;z-index: 3;margin-left: 38px;height: 30px;line-height: 30px;">
                  <font style="font-weight: bold">共有内设机构20个</font>
              </div>
          </div>

解决非固定宽度的浮动问题:

结束加上<div style="clear:both;height: 0px;"></div>

js改变背景颜色:
document.getElementById('mycolor').style.background=yc

显示不显示:

document.getElementById("ah2").style.display = "block";

$("#id").css('display','none');

$("#id")[0].style.display = 'none';

图片在div中居中显示(水平居中和垂直居中):
水平居中:div设置:text-align:center;
img设置:width:图片宽度; margin:0 auto;

垂直居中:div设置:position:relative;
img设置:position:absolute; top:50%; height:图片高度; margin-top:图片高度的一半;

让两个Div并排显示:

<div style="width:300px; height:auto; float:left; display:inline">AAAA</div>

<div style="width:300px; height:auto; float:left; display:inline">BBBB</div>

table中的td换行:

在table定义中,添加style="table-layout:fixed;"

在对需要换行的td中,添加style="word-break:break-all;"

预打印:

分页  <br style="page-break-after: always;" />

打印时不显示

<style>
@media print {
  .noprint {
  display: none
  }
}
</style>

<tr align="center" class="noprint">

点击文字可以选中相应的checkbox  :

<input id="check1" name="tag" type="checkbox" value="长发"/><label for="check1">长发</label>

图片居中:

img{ display:block; margin:0 auto;}

优先级:

.style1{
 color: #5a5100 !important;
 text-decoration: none;
}

CSS备忘的更多相关文章

  1. Css 备忘知识点

    1.Chrome 中文界面下默认会将小于 12px 的文本强制按照 12px 显示,可通过加入 CSS 属性 -webkit-text-size-adjust: none; 2.HTML5的form如 ...

  2. CSS备忘笔记

    一.CSS的概念 CSS(Cascading Style Sheet),中文译为层叠样式表,它是用于控制网页样式并允许将样式信息与网页内容分离的一种标记性语言. 二.CSS使用方式 使用CSS控制页面 ...

  3. CSS备忘-1

    CSS 可以通过以下方式添加到HTML中: 内联样式- 在HTML元素中使用"style" 属性 内部样式表 -在HTML文档头部 <head> 区域使用<sty ...

  4. 常用CSS备忘

    1 怎样让div中的img居中 水平居中:div设置:text-align:center; img设置:width:图片宽度; margin:0 auto; 垂直居中:div设置:position:r ...

  5. [CSS备忘] css3零散

    -webkit-overflow-scrolling:touch;下拉滚动回弹

  6. [CSS备忘]改变选中文本的颜色::selection

    /*Webkit,Opera9.5+,IE9+*/ ::selection { background:red; color:white; } /*Firefox*/ ::-moz-selection ...

  7. [CSS备忘]多行文本省略号

    overflow : hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box ...

  8. CSS 备忘

    border-radius :  10px  /  40px    10表示X轴半径   40表示Y轴半径   font:italic bold 13px/13px arial,sans-serif; ...

  9. CSS系列:less备忘

    less备忘 //这是一个运行在koala中的less文件,//注释不会被编译到css文件中,/**/注释会 ****************by 李可 2016/04/19 /*所有,所有伪类*/ ...

随机推荐

  1. POJ1523 SPF

    Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 8254   Accepted: 3772 Description Consi ...

  2. Bsoj 1322 第K小数

    第K小数 Description 现在已有N个整数,你有以下三种操作: 1 A:表示加入一个值为A的整数: 2 B:表示删除其中值为B的整数: 3 K:表示输出这些整数中第K小的数: Input 第一 ...

  3. Selenium2+python自动化13-Alert

    不是所有的弹出框都叫alert,在使用alert方法前,先要识别出它到底是不是alert.先认清楚alert长什么样子,下次碰到了,就可以用对应方法解决.alert\confirm\prompt弹出框 ...

  4. Matlab中的括号()[]{}

    Matlab中的括号()[]{} Matlab中经常会用到括号去引用某Array或者是cell的内容,但三者有什么具体区别呢?[ ] 中括号用来构建向量(Vectors)或者是矩阵(Matrices) ...

  5. Protocol Buffer技术详解(Java实例)

    Protocol Buffer技术详解(Java实例) 该篇Blog和上一篇(C++实例)基本相同,只是面向于我们团队中的Java工程师,毕竟我们项目的前端部分是基于Android开发的,而且我们研发 ...

  6. The illustrated guide to a Ph.D.

  7. 利用a标签自动解析URL

    parseURL // This function creates a new anchor element and uses location // properties (inherent) to ...

  8. 基于REST架构的Web Service设计

    来自: http://www.williamlong.info/archives/1728.html 先前我曾经介绍过利用Apache Axis实现基于SOAP的Web Service实现技术和相关代 ...

  9. 防止ajax请求重发

    debounce  ajax请求,防止用户点击过快造成重发 按钮disabled处理,显示loading,防止用户失去耐心,重复点击 表单提交也可以同样处理.

  10. spring mvc实现新增用户

    spring mvc实现新增用户 1.先在展示页面(查询出来的结果页)添加一个连接<a href="add">添加</a> 2.在后台添加一个添加的方法,点 ...