CSS的一些常用样式,如背景、文字、文本、表格、列表等,以及一些常用的场景,如居中对齐、溢出、隐藏元素等。01、常用样式 1.1、background背景 设置元素背景的样式 background,更
顺晟科技
2021-09-24 13:19:22
87
<div class="box box1">
<span>垂直居中</span>
</div>
.box1{
display: table-cell;
vertical-align: middle;
text-align: center;
}
.box2{
display: flex;
justify-content:center;
align-items:Center;
}
javascript:void(0);
object-fit: cover;
父级:
overflow-y: hidden;
overflow-x: auto;
white-space: nowrap;
.organ-result-content{
width: 70%;
height: 50px;
overflow-y: hidden;
overflow-x: auto;
white-space: nowrap;
font-size: 12px;
position: fixed;
bottom: 50px;
}
.organ-result-content-item{
width: 65px;
height: 28px;
margin-top: 10px;
margin-left: 5px;
text-align: center;
line-height: 28px;
display: inline-block;
border: 1px dashed #999;
color: #666;
position: relative;
}
cursor: pointer;
-o-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-ms-user-select: none;
-khtml-user-select :none;
user-select: none;
设置边框不包含在长宽度里面:
box-sizing: border-box;
顶部固定效果
.tabbar{
position:stycky;
top:0;
z-index:999
}
CSS实现单行、多行文本溢出显示省略号(…)
overflow: hidden;
text-overflow:ellipsis;
white-space: nowrap;
calc( - 20px)计算
position:absolute;position:relative定位使用通常是父级定义position:relative定位,子级定义position:absolute定位属性,并且子级使用left或right和top或bottom进行定位。
<div style="background-color:#ffffff;padding-left:10px;">测试jQuery动态获取padding-left</div>
$("div").css("padding-left"));
$("div").css("color","yellow");
$("div").css({"background-color":"yellow","font-size":"200%"});
var css = {
background-color: '#EEE',
height: '500px',
margin: '10px',
padding: '2px 5px'
};
$("div").css(css);
npm install --save @babel/polyfill
轮播图插件
阴影制作生成链接
https://caniuse.com/
npm install formdata-polyfill
// 解决 ie浏览器图片上传 失败问题
import "formdata-polyfill";
// 登录ie内核浏览器 禁止访问该系统推荐使用Google(谷歌浏览器)
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
if (userAgent.indexOf('Trident') !== -1 || userAgent.indexOf('MSIE') !== -1) { //表示使用的是IE的内核
alert("该系统暂时不支持IE内核浏览器,推荐使用Google(谷歌浏览器)")
} else{
this.onNavgate()
}
nodelist-foreach-polyfill
white-space: pre-line;
location.href = `${urlConfig.xsgl_serverUrl}${urlConfig.getExportAllHtqdAll}?xsglHtId=${this.params.dqJdId}`
git clone -b 分支名仓库地址
data: {
tabs:[]
}
let tabs = this.data.tabs; //浅拷贝
let tabs = JSON.parse(JSON.stringify(this.data.tabs)); //深拷贝
url拼接:http://172.18.19.22:19076/flexoffice/web/dist/modules/login/sso_login.html?loginName="+userName+"&token="+data
可以将json字符串转换成json对象
JSON.parse(jsonstr);
将json对象转换成json对符串
JSON.stringify(jsonobj);
父级:position:relative;
img{
max-height:340px;
max-width:690px;
position:absolute;
left:0;
right:0;
top:0;
bottom:0;
margin:auto;
}
09
2022-11
31
2022-10
19
2022-10
19
2022-10
15
2022-09
15
2022-09