HTML+CSS常用代码
文本水平居中:text-align:center; 文本垂直居中:height:30px;line-height:30px;
块垂直居中:verticalaline:middle;
圆角:border-radius:25px;
透明度:opacity:0.5; background-color: rgba(255,255,255,.2);
旋转角度:-webkit-transform: rotate(-90deg);
背景图片自适应:background-repeat: no-repeat; position: absolute; display:inline-block; background-size: cover;
元素选择器:nth-child(n) 匹配属于其父元素的第 N 个子元素,不论元素的类型。
:link 选择器设置了未访问过的页面链接样式,
:visited 选择器设置访问过的页面链接的样式,
:hover 选择器当有鼠标悬停在其上的链接样式。
小三角箭头:border-width:13px; border-style:solid dashed dashed; border-color:transparent transparent #fff transparent;
渐变:background: linear-gradient(red, blue);从上到下渐变
background: linear-gradient(to right, red , blue); 从左到右渐变
background: linear-gradient(to bottom right, red , blue);从左上角到右下角的线性渐变:
background: linear-gradient(180deg, red, blue); 从角度渐变
文本过长变省略号:text-overflow:ellipsis
文本过长隐藏:text-overflow:clip
禁止换行:white-space:nowrap;
鼠标变小手:cursor:pointer;
超过两行省略号:overflow : hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical;
超过省略:overflow: hidden;text-overflow: ellipsis;white-space: nowrap;
强制不换行: white-space:nowrap;
自动换行: word-wrap: break-word; word-break: normal;
强制英文单词断行: word-break:break-all;
首行缩进:text-indent:2em; text-indent:25px;
图片放大:transform: scale(1.08);transition-duration: .8s;overflow: hidden;-webkit-transition: all 0.2s linear; transition: all 0.2s linear;
边框阴影: box-shadow:0 0 1px #000 inset;