CSS备忘
垂直居中:
先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备忘的更多相关文章
- Css 备忘知识点
1.Chrome 中文界面下默认会将小于 12px 的文本强制按照 12px 显示,可通过加入 CSS 属性 -webkit-text-size-adjust: none; 2.HTML5的form如 ...
- CSS备忘笔记
一.CSS的概念 CSS(Cascading Style Sheet),中文译为层叠样式表,它是用于控制网页样式并允许将样式信息与网页内容分离的一种标记性语言. 二.CSS使用方式 使用CSS控制页面 ...
- CSS备忘-1
CSS 可以通过以下方式添加到HTML中: 内联样式- 在HTML元素中使用"style" 属性 内部样式表 -在HTML文档头部 <head> 区域使用<sty ...
- 常用CSS备忘
1 怎样让div中的img居中 水平居中:div设置:text-align:center; img设置:width:图片宽度; margin:0 auto; 垂直居中:div设置:position:r ...
- [CSS备忘] css3零散
-webkit-overflow-scrolling:touch;下拉滚动回弹
- [CSS备忘]改变选中文本的颜色::selection
/*Webkit,Opera9.5+,IE9+*/ ::selection { background:red; color:white; } /*Firefox*/ ::-moz-selection ...
- [CSS备忘]多行文本省略号
overflow : hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box ...
- CSS 备忘
border-radius : 10px / 40px 10表示X轴半径 40表示Y轴半径 font:italic bold 13px/13px arial,sans-serif; ...
- CSS系列:less备忘
less备忘 //这是一个运行在koala中的less文件,//注释不会被编译到css文件中,/**/注释会 ****************by 李可 2016/04/19 /*所有,所有伪类*/ ...
随机推荐
- js中改变不同的div属性值的操作
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- How much training data do you need?
How much training data do you need? //@樵夫上校: 0. 经验上,10X规则(训练数据是模型参数量的10倍)适用与大多数模型,包括shallow networ ...
- win10系统安装.net35的命令行方式
有些程序在windows系统中需要安装.net35才能运行,下载太慢了,可以直接在docs窗口直接安装,命令行如下:Dism /online /enable-feature /featurename: ...
- 刨根问底拦不住——I/O模型
前言 看过很多资料,很多对I/O模型概念模糊甚至错误,希望这篇文章有助理解I/O,欢迎讨论和纠正 参考资料:<UNIX网络编程卷1> P122 I/O中涉及概念 介绍阻塞非阻塞,同步异步 ...
- rwsr-sr-x类似权限设置
如何设置suid/guid? 如果希望设置suid,那么就将相应的权限位之前的那一位设置为4:如果希望设置guid,那么就将相应的权限位之前的那一位设置为2:如果希望两者都置位,那么将相应的权限位之前 ...
- jquery uploadify 使用
/*进度条框*/ .shangchuantishikuang { border: 7px solid #74A5BF; background-color: white; font-size: 14px ...
- .NET笔试面试题
.NET 1.const和readonly的区别? 2.静态类和实例区别?什么时候使用? 3.接口和抽象类的区别?什么时候使用? 4.类和结构体的区别?什么时候使用? 5.文件操作 6.序列化 7.O ...
- TableInputFormat分片及分片数据读取源码级分析
我们在MapReduce中TextInputFormat分片和读取分片数据源码级分析 这篇中以TextInputFormat为例讲解了InputFormat的分片过程以及RecordReader读取分 ...
- HDOJ 2063 过山车
过山车 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...
- 昂贵的聘礼(dijkstra)
昂贵的聘礼 Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 38549 Accepted: 11158 Descripti ...