在悬停按钮上缩放元素会导致文本模糊

时间:2019-03-28 08:06:31

标签: html css

我有一个模态,当我将鼠标悬停在按钮上时会缩放,从而导致按钮文本模糊效果

我尝试了-webkit-font-smoothing:亚像素抗锯齿;我尝试了隐藏背面可见性,perspective(1px),但似乎没有任何作用

.overlay {
    height: 100vh;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    background-color: rgba(50, 65, 97, 0.5);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all .3s; }
.overlay .cancel {
    position: absolute;
    width: 100%;
    height: 100%;
    cursor: default; }
.overlay__content {
    position: absolute;
    top: 44%;
    left: 55.5%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 24px;
    width: 460px;
    background-color: #ffffff;
    box-shadow: 0 2rem 4rem rgba(81, 136, 255, 0.2);
    border-radius: 8px;
    display: table;
    overflow: hidden;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.25);
    backface-visibility: hidden;
    transition: all .4s .2s; }

.show-modal {
    opacity: 1;
    visibility: visible; }

.show-modal .overlay__content {
    will-change: auto;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    backface-visibility: hidden; }

.heading-primary {
    color: #ff6f6c;
    font-size: 2rem;
    margin-bottom: 2.4rem;
    font-weight: bold; }

.form__label {
    font-size: 1.4rem;
    color: #324161;
    display: table-header-group;
    transition: all 0.3s ease;
    display: inline-block;
    margin-bottom: 4px; }

.btn-group {
    float: right;
    display: inline-flex;
    vertical-align: middle; }
.btn-group > .btn {
    position: relative;
    -webkit-box-flex: 0;
    -webkit-flex: 0 1 auto;
    -ms-flex: 0 1 auto;
    flex: 0 1 auto;
    min-width: 16rem;
    width: auto; }

.btn, .btn:link, .btn:visited {
    text-transform: uppercase;
    text-decoration: none;
    padding: 1rem 1.6rem;
    display: inline-block;
    border-radius: 4px;
    transition: all .2s;
    position: relative;
    font-size: 1.4rem;
    font: normal 1.4rem 'Nunito';
    width: 100%;
    border: none;
    cursor: pointer;
    margin-top: 4rem;
    text-align: center;
    font-family: inherit; }

.btn:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 1rem 2rem rgba(81, 136, 255, 0.1); }
.btn:hover::after {
    opacity: 0; }

.btn::after {
    content: "";
    display: inline-block;
    height: 100%;
    width: 100%;
    border-radius: 8rem;
    position: absolute;
    top: 0;
    left: 0;
    z-index: -1;
    transition: all .4s; }

.btn:active, .btn:focus {
    outline: none;
    transform: translateY(-1px);
    box-shadow: 0 0.5rem 1rem rgba(81, 136, 255, 0.1); }

.btn--primary {
    background-color: #5188ff;
    color: #ffffff;
    font-weight: bold;
    font-family: inherit; }
.btn--primary:after {
    background-color: #5188ff; }
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  <link rel="stylesheet" href="http://cdn.materialdesignicons.com/3.0.39/css/materialdesignicons.min.css">
  <link href="https://fonts.googleapis.com/css?family=Nunito:100,300,400,700,900" rel="stylesheet">
  <link rel="stylesheet" href="style.css">
  <link rel="icon" type="image/png" href="../icons/tms_favicon.png">
  <title></title>
</head>

<body>
<main>




  <section>
    <!-- Pop up Delete User modal -->
    <div class="overlay show-modal" id="modal1">
      <a class="cancel" href="#_"></a>
      <div class="overlay__content">
        <h3 class="heading-primary">Delete User</h3>
        <label class="form__label">Are you sure you want to delete the user John Doe?</label>

        <div class="btn-group">
          <button class="btn btn--secondary">Cancel</button>
          <button class="btn btn--primary btn--with-icon">Delete<span class="mdi mdi-delete-outline icon--inside-button"></span></button>
        </div>

      </div>
    </div>
    <!-- Pop up modal -->
  </section>
</main>
</body>
</html>

有人可以帮助我吗?我不知道该怎么办,我也认为此错误仅在Chrome上存在。

0 个答案:

没有答案