css常用命令

自定义光标

cursor:auto;//url || default || auto || crosshair || pointer || move || wait || help

去除input,a,buttom的基本样式

input,textarea,a,buttom{  
    background:none;  
    outline:none;  
    border:none;
}
input:focus,textarea:focus,a:focus,buttom:focus{   
    border:none;
}
input:-webkit-autofill , textarea:-webkit-autofill, select:-webkit-autofill {
      -webkit-box-shadow: 0 0 0px 1000px white inset;
      border: 0px !important;
}

阴影的用法

 box-shadow: 10px 10px 20px 10px rgba(255,255,0,0.5), -10px 10px 10px 10px rgba(255,255,255,0.5) 

注意事项:多个阴影可以用逗号隔开

例子:

.test{ 
  width: 100px; 
  height: 100px; 
  background: yellow; 
  margin: 100px auto; 
  border-radius: 50%; 
  box-shadow: 0px 0px 10px 5px rgba(0,0,0,0.9); 
  transform: scale(1); 
  transition: box-shadow 0.6s, transform 0.5s; 
}
.test:hover{
	width: 100px;
	height: 100px;
	background: yellow;
	margin: 100px auto;
	border-radius: 50%;
	box-shadow: 0px 0px 50px 15px rgba(0,0,0,0.9);
	transition: box-shadow 0.5s;
}

居中

水平居中对齐

思路一:

margin:0 auto;
text-align:center;

思路二:flex布局

display:flex;
justify-content: center;

垂直居中对齐

思路一:行高和dom元素高相同

height:100px;
line-height: 100px;

思路二:flex布局

display: flex;
justify-content: center;	/*水平居中对齐*/
align-items: center;        /*垂直居中对齐*/

思路三:display: -webkit-box;

display: -webkit-box;
-webkit-box-align: center;
-webkit-box-pack: center;

思路四:绝对定位

  1. 利用左定位:50% - 宽度的一半;顶定位:50% - 高度的一半;可用于有确定宽高的元素。
position: absolute;
width: 50px;
height: 50px;
left: calc(50% - 25px);
top: calc(50% - 25px);
  1. 另一种,不需要宽高;利用四周都为0,margin:auto;来实现居中。
position: absolute;
margin: auto;
top:0;
bottom:0;
left:0;
right:0;

思路五:table-cell

display: table-cell;
vertical-align: middle;

transform 变幻

transform:rotate(7deg);
-ms-transform:rotate(7deg); 	/* IE 9 */
-moz-transform:rotate(7deg); 	/* Firefox */
-webkit-transform:rotate(7deg); /* Safari 和 Chrome */
-o-transform:rotate(7deg); 	/* Opera */

变形的参数

flax布局

.div{
	display: flex;
    flex-direction: row;
    justify-content: space-between;
    vertical-align: top;
    justify-self: flex-start;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值