!!!常用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="1408587440309.png" class="img_abc">
<img src="1408587445662.png" class="img_abc">
<img src="1408587456115.png" class="img_abc">
</div>
用图片替代:文件上传按钮
<div class="file-box">
<input type="file" id="focusPic" name="focusPic" class="fileupload-hidden" onchange="showCurrentImg('focusImg')">
<img src="http://images.csdn.net/20140820/up.jpg" class="img-file-btn">
</div>
<style type="text/css">
.file-box{position: relative;width: 120px;height: 90px;overflow: hidden;border: 1px solid #F0F0F0;}
.fileupload-hidden {width: 120px;height: 90px;position: absolute;left: 0;top: 0;right: 0;bottom: 0;z-index: 2;margin: 0;padding: 0;font-size: 1000px;opacity: 0;filter: alpha(opacity=0);}
.img-file-btn {position: absolute;left: 0;top: 0;right: 0;bottom: 0;width: 100%;height: 100%;z-index: 1;}
</style>
div居中
.main{clear:both;width:1000px;margin:0 auto;} /*常规写法*/
.main{clear:both;width:1000px;margin-left:auto;marght-right:auto;} /*改良写法*/
屏幕居中
<style type="text/css">
div{position:fixed;margin:auto;left:0;right:0;top:0;bottom:0;width:200px;height:150px;background:#f90;line-height:150px;text-align:center;}
</style>
<div id="dd">屏幕居中</div>
两列:左边一列宽200px,右边一列充满剩余宽度
<style type="text/css">
div{border:1px solid #000;}
.box{overflow:auto;margin:0 auto;width:1000px;}
.left{width:200px;float:left;}
.right{margin-left:200px;}
</style>
<div class="box">
<div class="left">的的的的的的的的的</div>
<div class="right">啊啊啊啊啊啊啊啊啊啊</div>
</div>
字体效果
<style type="text/css">
h1{margin:20px 0 30px 0;padding:0;line-height:115px;font-size:120px;font-weight:bold;text-shadow:0 0 15px rgba(0,0,0,0.5);}
</style>
<div style="background:#069;">
<h1 style="color:#FFF;">WATCH</h1>
</div>
<div style="background:#FFF;">
<h1 style="color:#000;">WATCH</h1>
</div>
在链接的前后,用css添加内容
<style type="text/css">
a:before{content: "["attr(href)"]"; color:#f90;font-weight:bold;}
a:after{content: "[点击链接]"; color:#f90;font-weight:bold;}
</style>
<a href="http://www.w3school.com.cn" target="_blank">在链接的前后添加内容</a>
http://sandbox.runjs.cn/show/lvgpes2k 利用HTML5 的Datalist 元素实现输入提示 2014-9-15
!!!常用CSS代码块的更多相关文章
- 常用CSS代码大全(工作必备)
用html+css可以很方便的进行网页的排版布局,但不是每一种属性或者代码我们都铭记于心,最近我把CSS中的常用代码进行了归纳总结,方便自己以后查看,同时也分享给大家,希望对你们有用. 一.文本设置 ...
- discuz内置常用CSS代码分析
CSS多IE下兼容HACK写法 所有 IE浏览器适用:.ie_all .foo { ... } IE6 专用:.ie6 .foo { ... } IE7 专用:.ie7 .foo { ... } IE ...
- !!!常用JS代码块 (jquery)
jquery代码块 <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script> ...
- !!!常用CSS代码
http://www.cnblogs.com/qq21270/p/4854643.html 伪类 http://www.cnblogs.com/qq21270/p/4891167.html CSS3动 ...
- 常用css代码(scss mixin)
溢出显示省略号 参过参数可以只是单/多行. /** * 溢出省略号 * @param {Number} 行数 */ @mixin ellipsis($rowCount: 1) { @if $rowCo ...
- 常用CSS代码片段常见css bug
1.禁止文字被选中 .unselectable { -moz-user-select: -moz-none; -khtml-user-select: none; -webkit-user-select ...
- Android常用功能代码块
1.设置activity无标题,全屏 // 设置为无标题栏 requestWindowFeature(Window.FEATURE_NO_TITLE); // 设置为全屏模式 getWindow(). ...
- Android常用功能代码块(转)
1.设置activity无标题,全屏 // 设置为无标题栏 requestWindowFeature(Window.FEATURE_NO_TITLE); // 设置为全屏模式 getWindow(). ...
- 常用CSS代码片断
单行文本截字 .nowrap { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; word-break: normal; ...
随机推荐
- 隐藏WORDPRESS账户登录错误信息
将下面的脚本添加到当前主题的functions.php文件中. function no_wordpress_errors(){ return 'Something is wrong!';}add_f ...
- bootstrap validator 出现Maximum call stack size exceeded
如果用 c# 里面用的是 taghelper 的控件,有可能造成 Maximum call stack size exceeded bootstrap validator 必须是继承 bootst ...
- postman操作练习用例
1.注册用户:http://api.nnzhp.cn/api/user/user_reg 2.登录用户:http://api.nnzhp.cn/api/user/login 3.添加学生:http:/ ...
- 配置JAVA开发环境
以下为搭建java的开发环境...... 第一步:安装JDK 1. 了解一下 JVM(Java Virtual Machine—Java虚拟机) JRE(Java Runtime Environmen ...
- Fiddler常用命令
几个常用的命令行方法使用: 查找对应响应码的数据包或请求类型的数据包: 输入“=post”将选择post的数据包并用蓝色底标色 输入:=502 查找服务器返回是图片类型的请求 输入 select im ...
- 2017年3月28日15:59:16 终于明白spring这套鬼东西是怎么玩的了
先说重点,新东家公司的项目框架没有一样是我之前用过的,首先pm和我说的是一套微服务的概念,微服务不同于传统的功能模块实现,他将服务松散化分不到各个系统之间,这样也是实现分散压力的一种. 微服务是由sp ...
- Power BI和 Visio 集成优缺点
Power BI 的 Visio 自定义视觉,这个功能是非常值得让人兴奋的,小悦相信这是一个非常重要的开发,不仅适用于 Visio,也适用于Power BI.现在已经有越来越多的可视化,它们以更简洁的 ...
- 【leetcode】453. Minimum Moves to Equal Array Elements
problem 453. Minimum Moves to Equal Array Elements 相当于把不等于最小值的数字都减到最小值所需要次数的累加和. solution1: class So ...
- MP和OMP算法
转载:有点无耻哈,全部复制别人的.写的不错 作者:scucj 文章链接:MP算法和OMP算法及其思想 主要介绍MP(Matching Pursuits)算法和OMP(Orthogonal Matchi ...
- terminal、Shell、tty和console
最早的电脑有带很多开关和指示灯的面板——console(概念来自管风琴),一台电脑通常一个Console,化为主机一部分,和CPU共享机柜. 一台大型主机往往支持多用户,每个用户使用的终端——term ...