1.多行显示
overflow:hidden;
text-overflow:ellipsis;
display:-webkit-box;
-webkit-line-clamp:2;
-webkit-box-orient:vertical;
2.flex中让左边盒子固定大小不换行
.con_wrapper{
display:flex;
}
.con_wrapper .left{
width:50px;
position:absolute;
}
.con_wrapper .right{
}
3.
text-align: justify; &:after { content: "."; width: 100%; display: inline-block; overflow: hidden; height: 0; }
4.flex布局左边文字发生换行,使用定位
5.页面布局上中下,中间使用定位自适应高度,然后使用滚动
position:absolute;
top:45px;
bottom:45px;
width:100%;
overflow-y:scroll;
6.页面出现左右摇动不固定的情况,如果直接在body失效,可以具体在哪个页面
overflow-x: hidden;
注意值为auto 与 scroll 的区别
7.750px设计稿移动端适配
body { min-width: 320px; // max-width: 750px; /* flexible 给我们划分了 10 等份 */ width: 10rem; margin: 0 auto; line-height: 1.5; font-family: Arial, Helvetica; background: white;}
设置最大为750版心大小 @media screen and (min-width: 750px) { html { font-size: 75px !important; }
}
8.一些细节
缩进2个字符text-indent: 2em;
input设置宽度<input size="12" />
善于使用::after 与before
浏览器最小字体12px 可以设置transform: scale(0.85);缩小,设置为行内样式
修改element组件样式,添加/deep/
header 与 footer 固定 , 中间 自适应 1. 可以使用定位 top与bottom 2 . 直接设置高度
height:calc(100vh - header- footer)
width: fit-content; div宽度有内容决定,有宽高的p标签
.setAttribute是给html元素属性设置值的。
例如<div id="name" class="text"><div>中的id和class就是html元素属性。
.style.setProperty="值"是用来设置css样式的。
例如document.getElementById("#name").style.background="red"设置文本框的背景颜色为红色。
.classList.add
以上: 修改标签中属性 , 修改style , 修改整个类
style样式是个 CSSStyleDeclaration 对象,提供cssText属性 ,
也提供 setProperty()、getPropertyValue()及removeProperty() 方法