随笔——一些常用样式的设置

1 篇文章 0 订阅

一些常用样式的设置


一、一行或者多行文本显示省略号

// 一行或者多行文本显示省略号
.omitCommon {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
}
.doubleOmit {
  .omitCommon;
  -webkit-line-clamp: 2;
}

二、ant design-form表单去掉必填项前面的星号*及后面的冒号

/* 表单去掉必填项前面的星号*及后面的冒号 */
.special_form {
  .ant-form-item-label > label::after {
    content: '';
    position: relative;
    top: -0.5px;
    margin: 0 10px 0 0;
  }
  .ant-form-item-label
    > label.ant-form-item-required:not(.ant-form-item-required-mark-optional)::before {
    display: none;
  }
}

三、flex

/* ==========================================================
   flex:定义布局为盒模型
   flex-v:盒模型垂直布局
   flex-1:子元素占据剩余的空间
   flex-align-center:子元素垂直居中
   flex-pack-center:子元素水平居中
   flex-pack-justify:子元素两端对齐
   兼容性:ios 4+、android 2.3+、winphone8+
   ============================================================ */
.flex {
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
}
.flex-v {
  -webkit-box-orient: vertical;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
}
.flex-1 {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
}
.flex-2 {
  -webkit-box-flex: 2;
  -webkit-flex: 2;
  -ms-flex: 2;
  flex: 2;
}
.flex-align-center {
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
}
.flex-pack-center {
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
}
.flex-pack-justify {
  -webkit-box-pack: justify;
  -webkit-justify-content: space-between;
  -ms-flex-pack: justify;
  justify-content: space-between;
}

四、底部固定的Footer

/* ==========================================================
    底部固定的Footer
  ============================================================ */
.Footer {
  position: fixed;
  bottom: 0;
  left: 207px;
  display: flex;
  background: #fff;
  justify-content: center;
  align-items: center;
  box-shadow: 0px -4px 10px 0px rgba(187, 189, 202, 0.19);
  height: 64px;
  line-height: 64px;
  z-index: 100;
  &.unfold {
    // 左侧侧边栏未折叠时
    left: 80px;
    width: calc(100% - 80px);
  }
  &.fold {
    // 左侧侧边栏折叠时
    left: 207px;
    width: calc(100% - 207px);
  }
  button {
    width: 80px;
    height: 32px;
    font-size: 12px;
    &:nth-last-of-type(2) {
      margin-right: 30px;
    }
  }
}

五、文本内换行(需要单独设置合适的宽度)

/* ==========================================================
    文本内换行(需要单独设置合适的宽度)
  ============================================================ */
.special_wrap {
  white-space: pre-line;
  display: inline-flex;
  word-break: break-all;
}

六、重置样式

html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  display: block;
}
body {
  line-height: 1;
  overflow: hidden;
}
ol,
ul {
  list-style: none;
}
blockquote,
q {
  quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
  content: '';
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}

html,
body {
  height: 100%;
  width: 100%;
  background-color: #f5f5f5;
  overflow: hidden;
}

#root {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值