Skip to content

Commit 2471a6e

Browse files
committed
add link
1 parent 23773a3 commit 2471a6e

File tree

1 file changed

+181
-2
lines changed

1 file changed

+181
-2
lines changed

css-2.x.md

Lines changed: 181 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#以下是常用的代码收集,没有任何技术含量,只是填坑的积累。转载请注明出处,谢谢。
1+
### 以下是常用的代码收集,没有任何技术含量,只是填坑的积累。转载请注明出处,谢谢。
22

33
- 文字换行
44
```css
@@ -9,4 +9,183 @@ word-wrap: break-word;
99
word-break: normal;
1010
/*强制英文单词断行*/
1111
word-break:break-all;
12-
```
12+
```
13+
14+
- 两端对齐
15+
```css
16+
text-align:justify;text-justify:inter-ideogra
17+
```
18+
19+
- [去掉Webkit(chrome)浏览器中input(文本框)或textarea的黄色焦点框](http://www.cnblogs.com/niao/archive/2012/09/07/2674511.html)
20+
```css
21+
input,button,select,textarea{ outline:none;}
22+
textarea{ font-size:13px; resize:none;}
23+
```
24+
25+
- 文字换行
26+
```css
27+
[去掉chrome记住密码后自动填充表单的黄色背景](http://www.tuicool.com/articles/EZ777n )
28+
```
29+
- ie6: position:fixed
30+
```css
31+
.fixed-top /* position fixed Top */{position:fixed;bottom:auto;top:0; }
32+
* html .fixed-top /* IE6 position fixed Top */{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));}
33+
*html{background-image:url(about:blank);background-attachment:fixed;}
34+
```
35+
36+
- clearfix
37+
```css
38+
.clearfix:after{visibility:hidden;display:block;font-size:0;content:" ";clear:both;height:0;}
39+
.clearfix{display:inline-block;}
40+
html[xmlns] .clearfix{display:block;}
41+
* html .clearfix{height:1%;}
42+
43+
.clearfix{*zoom: 1;}
44+
.clearfix:after{clear:both;display:table;content:"”;}
45+
46+
.clearfix{overflow:hidden;_zoom:1;}
47+
```
48+
[http://www.daqianduan.com/3606.html](http://www.daqianduan.com/3606.html)
49+
50+
- seperate-table
51+
```css
52+
.tab{border-collapse:separate;border:1px solid #e0e0e0;}
53+
.tab th,.tab td{padding:3px;font-size:12px;background:#f5f9fb;border:1px solid;border-color:#fff #deedf6 #deedf6 #fff;}
54+
.tab th{background:#edf4f0;}
55+
.tab tr.even td{background:#fff;}
56+
```
57+
```html
58+
<table class="tab" width="100%" cellpadding="0" cellspacing="0" border="0">
59+
<tr>
60+
<th>111</th>
61+
<td>222</td>
62+
</tr>
63+
<tr>
64+
<th>111</th>
65+
<td>222</td>
66+
</tr>
67+
</table>
68+
```
69+
70+
- min-height: 最小高度兼容代码
71+
```css
72+
.minheight500{min-height:500px;height:auto !important;height:500px;overflow:visible;}
73+
```
74+
- 鼠标不允许点击
75+
```css
76+
cursor:not-allowed;
77+
```
78+
- mac font: osx平台字体优化
79+
```css
80+
font-family:"Hiragino Sans GB","Hiragino Sans GB W3",'微软雅黑';
81+
```
82+
- 省略号
83+
```css
84+
.ellipsis{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
85+
```
86+
- 投影
87+
```css
88+
.b{box-shadow:inset 1px -1px 0 #f1f1f1;text-shadow:1px 1px 0px #630;}
89+
filter:progid:DXImageTransform.Microsoft.gradient(enabled='true',startColorstr='#99000000',endColorstr='#99000000');background:rgba(0,0,0,.6);
90+
91+
background:rgba(0,0,0,0.5);filter:progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#50000000',endColorstr='#50000000')\9;
92+
```
93+
- [search占位](http://www.qianduan.net/search-box-style-custom-webkit.html)
94+
```css
95+
::-webkit-input-placeholder {}
96+
::-moz-input-placeholder {}
97+
input:focus::-webkit-input-placeholder { color: transparent; }
98+
-webkit-appearance:none; google边框去除
99+
input[type="search"]{-webkit-appearance:textfield;} // 去除chrome默认样式
100+
http://i.wanz.im/2011/02/04/remove_border_from_input_type_search/
101+
http://blog.csdn.net/do_it__/article/details/6789699
102+
line-height: normal; /* for non-ie */
103+
line-height: 22px\9; /* for ie */
104+
```
105+
- title 换行
106+
```css
107+
&#13;
108+
```
109+
- [全部浏览器的兼容代码生成](http://www.colorzilla.com/gradient-editor/ )
110+
[CSS 实现 textArea 的 placeholder 换行](http://segmentfault.com/a/1190000000362621)
111+
112+
- 阻止默认事件
113+
```css
114+
pointer-events:none;
115+
```
116+
- 变灰 gray
117+
```css
118+
html{
119+
filter: grayscale(100%);
120+
-webkit-filter: grayscale(100%);
121+
-moz-filter: grayscale(100%);
122+
-ms-filter: grayscale(100%);
123+
-o-filter: grayscale(100%);
124+
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0.3333 0.3333 0.3333 0 0 0 0 0 1 0\'/></filter></svg>#grayscale");
125+
filter:progid:DXImageTransform.Microsoft.BasicImage(grayscale=1);
126+
-webkit-filter: grayscale(1);
127+
}
128+
```
129+
- firefox 阻止选中
130+
```css
131+
-moz-user-focus:ignore;-moz-user-input:disabled;-moz-user-select:none;
132+
```
133+
- 箭头
134+
```css
135+
display:block;border:solid transparent;line-height: 0;width:0; height:0;border-top:solid #0288ce;border-width:8px 6px 0 6px;
136+
137+
border-style:solid; border-width:7px; border-color:transparent transparent transparent #ff7020;
138+
position:absolute;top: 0;left: 0;border-width:20px;border-style:solid;border-color:#d1ddde transparent transparent #d1ddde;
139+
```
140+
ie6 bug测试,把border-style设为dashed.
141+
142+
- 取消textarea右下角可拖动手柄
143+
```css
144+
resize:none
145+
```
146+
- 取消chrome form表单的聚焦边框
147+
```css
148+
input,button,select,textarea{outline:none}
149+
textarea{resize:none}
150+
```
151+
- 取消a链接的黄色边框
152+
```css
153+
a{-webkit-tap-highlight-color:rgba(0,0,0,0);}
154+
```
155+
- webkit 水平居中
156+
```css
157+
display:-webkit-box;-webkit-box-pack:center; -webkit-box-align: center;
158+
```
159+
- 取消chrome 搜索x提示
160+
```css
161+
input[type=search]::-webkit-search-decoration,
162+
input[type=search]::-webkit-search-cancel-button,
163+
input[type=search]::-webkit-search-results-button,
164+
input[type=search]::-webkit-search-results-decoration {
165+
display: none;
166+
}
167+
```
168+
- [chrome取消默认黄色背景](http://stackoverflow.com/questions/2338102/override-browser-form-filling-and-input-highlighting-with-html-css)
169+
```css
170+
input:-webkit-autofill {-webkit-box-shadow: 0 0 0px 1000px white inset;}
171+
input:-webkit-autofill,
172+
textarea:-webkit-autofill,
173+
select:-webkit-autofill {
174+
-webkit-box-shadow: 0 0 0 1000px white inset;
175+
}
176+
autocomplete="off"
177+
```
178+
- 手机版本网页a标记虚线框问题
179+
```css
180+
a:focus { outline:none; -moz-outline:none; }
181+
```
182+
- 焦点去除背景
183+
```css
184+
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
185+
-webkit-tap-highlight-color: transparent; // i.e. Nexus5/Chrome and Kindle Fire HD 7''
186+
```
187+
- placeholder占位符颜色自定义
188+
```css
189+
input:-moz-placeholder { color: #369; }
190+
::-webkit-input-placeholder { color:#369; }
191+
```

0 commit comments

Comments
 (0)