1 body {2 color:#fff;3 }1 .people‐first {2 color:green;3 }1 #laowang { 2 color:yello;3 }* {2 margin: 0 ;3 padding: 0 ;4 }1 ul li {2 list‐style;none;3 }1 h3>a {2 line‐height:36px;3 }1 div,2 p {3 font‐size:14px;4 }1 a::hover {2 background‐color:springgreen;3 }a::linka::visiteda::hovera::activeinput::focush1 + p { margin-top:50px}1 font‐style:italic;2 font‐weight: 400 ;3 font‐size:16px;4 font‐family:"Microsoft Yahei";5 font:italic 400 16px "Microsoft Yahei";1 color:pink;2 text‐align:center;3 text‐decoration:none;4 text‐indent:2em;5 line‐height:26px;例如h p div ul li
例如 a strong b em
注:连接标签里不能放链接
注:链接里可放块级元素,但最好把a转换成块级元素安全
行内块元素
例如 img input td
1 display:block;2 display:inline;3 display:inline‐block;1 background‐color:transparent;2 background‐img:url(./xx);3 background‐repeat:repeat | no‐repeat | repeat‐x | repeat‐y;4 background‐position:center center;5 background‐attachment:scroll | fixed;6 background:pink url(./) no‐repeat fixed center top;1 background‐size:500px 200px;//cover等比完全覆盖,contain等比宽高覆盖1 border‐width:5px;2 border‐style:solid; // dashed(虚线) dotted(点线)3 border‐color:black;45 border:5px solid black;1 margin:0 auto;//可使盒子水平居中2 margin‐left:‐1px;//用于消除紧挨着的边框border-collapseborder-collapse: collapse;border collapse 属性设置表格的边框是否被合并为一个单一的边框,还是象在标准的HTML 中那样分开显示。
1 border‐radius:10px;2 border‐radius:1px 2px 3px 4px;//右上角开始3 border‐top‐left‐radius:...;1 box‐shadow: 10px 10px 5px ‐5px rgba(0,0,0,.3);2 水平阴影 垂直阴影 [模糊 尺寸 颜色 外部或内部]
1 text‐shadow:10px 10px 5px rgba(0,0,0,.3);1 float:left;脱离标准流
一行显示,顶部对齐
具备行内块的特性
1 <div>2 <div>盒子</div>3 <div ></div>4 </div>1 .clearfix {2 clear: both;3 }1 <div >2 <div>盒子</div>3 </div>1 .clearfix {2 overflow:hidden;3 }1 <div >2 <div>盒子</div>3 </div>1 .clearfix::after {2 content: "";3 display: block;4 height: 0 ;5 clear: both;6 visibility: hidden;7 }89 .clearfix {10 *zoom: 1 ;11 }1 <div >2 <div>盒子</div>3 </div>1 .clearfix:before,2 .clearfix::after {3 content: "";4 display: table;5 }67 .clearfix::after {8 clear: both;9 }1011 .clearfix {12 *zoom: 1 ;13 }1 position:static;1 position:relative;1 position:absolute;1 position:fixed;1 position:stycky;边偏移
top
bottom
left
right
优先级
1 z‐index:2;1 display:block | inline | none ;2 块级 行内 无1 visibility:inherit | visible | hidden;2 继承 可视 隐藏1 overflow:visible | hidden | scroll | auto;2 不剪切,不加滚动条 隐藏 滚动条 自动
1 cursor:default;
1 cursor:pointer;
1 cursor:move;
1 cursor:text;
1 cursor:not‐allowed;1 input {2 outline:none;3 }1 textarea {2 resize:none;3 }1 vertical‐align:baseline | top | bottom | middle;2 基线对齐 顶线 底线 中线1 white‐space:nowrap;2 overflow:hidden;3 text‐overflow:ellipis;1 input[value]{}1 input[value="text"]{}1 div[class^=icon]{}1 div[class$=data]{}1 div[class*="iii"]{}1 :first‐child{}2 :last‐child{}3 :nth‐child(n){}//n可为数字 1 , 2 , 3 关键字even 偶数,odd奇数1 :first‐of‐type2 :last‐of‐type3 :nth‐of‐type(on)1 div::before{2 content="";3 }4 div::after{5 content="";6 }1 box‐sizing:conten‐box;//传统盒子模型2 box‐sizing:border‐box;//边框不占用大小,而是挤压内容1 filter:blur(5px);//进行布尔模糊1 width:calc(100%‐800px);1 transition:all 1s;//所选属性 花费时间 运动曲线 何时开始1 transform:translate(100px,‐50px);//纯移动,保留源2 transform:rotate(45deg);//顺时针旋转45°3 transform:scale(2,2);//长和宽变为原来的 2 倍45 transform:translate() rotate() scale();//简写1 transform‐style:flat | preserve;//开启3D空间(默认不开启)2 prespective:500px;//开启透视 设置透视高度34 transform:translate3d(x,y,x);//3d移动1 animation‐name:动画名称;2 animation‐duration:3s;//动画时间3 animation‐timing‐function:ease;//运动曲线4 animation‐delay:5s;//五秒之后开始5 animation‐iteration‐count:ifinite;//重复次数 无限6 animation‐direction:alternate;//逆向7 animation‐fill‐mode:forwards;//保持89 animation:动画名称 动画时间 [速度曲线 何时开始 播放次数 是否反向 结束状态];1 <meta name="viewport"2 content="width=device‐width,3 initial‐scale=1.0,4 user‐scalable=no,5 maximum‐scale=1.0,6 minimum‐scale=1.0">1 display:flex;1 flex‐direction: row;2 row‐reverse//右到左3 column//上到下4 column‐reverse//下到上1 justify‐content:flex‐start;// 左对齐(默认)2 flex‐end 右对齐3 center 居中4 space‐around 平均分配5 space‐between 先两侧贴边然后平均分1 flex‐wrap:nowrap;//不换行(默认)2 wrap;//换行1 align‐items:flex‐start;// 左对齐2 flex‐end 右对齐3 center 居中4 stretch 拉伸(默认值)1 align‐content:flex‐start;// 左对齐2 flex‐end 右对齐3 center 居中4 space‐around 平均分配5 space‐between 先两侧贴边然后平均分6 stretch 拉伸(默认值)1 flex:50%;2 align‐self:flex‐start;子项在侧轴的排列方式(了解)1 @media screen and (min‐width:500px){ //如果屏幕大于等于500px2 html{3 font‐size:14px;4 }5 }1 @color1: skyblue;2 @font14: 14px;3 body{4 background‐color:@color1;5 font‐size:@font14;6 a{7 text‐decration:none;8 &:hover{9 background‐color:@color1;10 font‐size:14px+16;11 }12 }13 }14 @import"common"//多个less合并在一起共同生成一份css文件