基于css变量修改的tooltips效果

代码语言:html

所属分类:布局界面

代码描述:基于css变量修改的tooltips效果

代码标签: 修改 tooltips 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开


<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
@import url("https://fonts.googleapis.com/css?family=Roboto:400,500&display=swap");
body {
  display: grid;
  -webkit-box-align: center;
          align-items: center;
  background: #1b1f1b;
  min-height: 100vh;
  color: white;
  font-family: 'Roboto', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.content {
  display: grid;
  grid-gap: 1em;
  margin: 0 auto;
  width: 100%;
  max-width: 500px;
  padding: 1em;
}

.preview {
  display: grid;
  -webkit-box-align: center;
          align-items: center;
  -webkit-box-pack: center;
          justify-content: center;
  height: 300px;
  background: #4a6775;
  border-radius: 5px;
  margin-bottom: 1em;
}

.tooltip {
  padding: var(--padding) var(--padding) calc(var(--padding) + var(--height));
  background: white;
  color: #1b1b1b;
  font-weight: 500;
}
.tooltip--left {
  -webkit-clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--height)), var(--width) calc(100% - var(--height)), 0 100%);
          clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--height)), var(--width) calc(100% - var(--height)), 0 100%);
}
.tooltip--center {
  -webkit-clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--height)), calc(50% + var(--width) / 2) calc(100% - var(--height)), 50% 100%, calc(50% - var(--width) / 2) calc(100% - var(--height)), 0 calc(100% - var(--height)));
          clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--height)), calc(50% + var(--width) / 2) calc(100% - var(--height)), 50% 100%, calc(50% - var(--width) / 2) calc(100% - var(--height)), 0 calc(100% - var(--height)));
}
.tooltip--right {
  -webkit-clip-path: polygon(0 0, 100% 0, 100% 100%, calc(100% - var(--width)) calc(100% - var(--height)), 0 calc(100% - var(--height)));
          clip-path: polygon(0 0, 100% 0, 100% 100%, calc(100% - var(--width)) calc(100% - var(--height)), 0 calc(100% - var(--height)));
}

.slider {
  display: grid;
  grid-template-areas: "a b" "c c";
  grid-gap: .5em;
  -webkit-box-pack: justify;
          justify-content: space-between;
}
.slider__label {
  grid-area: a;
  font-weight: 500;
}
.slider__value {
  grid-area: b;
  text-align: right;
  opacity: .8;
}
.slider__input {
  grid-area: c;
  -webkit-appearance: none;
     -moz-appearance: none;
          appearance: none;
  width: 100%;
  height: 1em;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  opacity: 0.7;
  -webkit-transition: opacity .2s;
  transition: opacity .2s;
  border-radius: 100px;
}
.slider__input:hover, .slider__input:active {
  opacity: 1;
}
.slider__input::-webkit-slider-thumb {
  -webkit-appearance: none;
          appearance: none;
  width: 1em;
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0