zent
Version:
一套前端设计语言和基于React的实现
110 lines (105 loc) • 2.4 kB
CSS
/*
WARNING: Do NOT use transform: translate(-50%, -50%) to center dialog, it makes content blurry.
With GPU rendering elements we are translating must be even numbers.
The bad news is that we cannot control the size of dialogs.
http://stackoverflow.com/questions/6411361/webkit-based-blurry-distorted-text-post-animation-via-translate3d
Here we're using inline-blocks to center the dialog.
https://css-tricks.com/centering-in-the-unknown/
*/
.zent-dialog-r-wrap {
position: fixed;
overflow: auto;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1050;
-webkit-overflow-scrolling: touch;
outline: 0;
text-align: center;
font-size: 0;
white-space: nowrap
}
.zent-dialog-r-wrap::before {
content: '';
height: 100%;
display: inline-block;
vertical-align: middle;/*
required
*/
}
.zent-dialog-r {
position: relative;
display: inline-block;
vertical-align: middle; /* required */
text-align: initial;
background-color: #fff;
border-radius: 4px;
padding: 20px;
-webkit-box-sizing: border-box;
box-sizing: border-box;
font-size: 14px;
white-space: normal;
}
.zent-dialog-r-title {
padding-bottom: 10px;
border-bottom: 1px solid #e5e5e5;
margin: 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
margin-bottom: 20px;
}
.zent-dialog-r-title-text {
font-size: 14px;
line-height: 1;
font-weight: bold;
color: #333;
}
.zent-dialog-r-close {
position: absolute;
display: inline-block;
top: 4px;
right: 10px;
color: #999;
font-size: 20px;
line-height: 20px;
text-align: right;
vertical-align: middle;
cursor: pointer;
border: none;
background-color: #fff;
outline: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
padding: 0 6px;
margin: 0
}
.zent-dialog-r-close:link, .zent-dialog-r-close:active, .zent-dialog-r-close:focus {
color: #999;
}
.zent-dialog-r-close.zent-dialog-r-has-title {
top: 14px;
right: 12px;
}
.zent-dialog-r-body {
color: #666
}
.zent-dialog-r-body.with-success-icon, .zent-dialog-r-body.with-warning-icon {
padding-left: 30px;
}
.zent-dialog-r-footer {
text-align: right;
margin-top: 30px;
}
.zent-dialog-r-backdrop {
position: fixed;
top: 0;
right: 0;
left: 0;
bottom: 0;
background-color: rgba(0, 0, 0, 0.6);
height: 100%;
z-index: 1050;
}