css:focus-visible实现按钮悬浮点击凹凸效果代码

代码语言:html

所属分类:悬停

代码描述:css:focus-visible实现按钮悬浮点击凹凸效果代码

代码标签: css 按钮 悬浮 点击 凹凸

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

<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  

  
<style>
:root {
  --bg-light: #efefef;
  --bg-dark: #1f3244;
  --focus-outline-color: black;
}

*:focus-visible {
  outline: 4px solid var(--focus-outline-color, black);
  outline-offset: 4px;
  border-radius: 4px;
}

@supports not selector(:focus-visible) {
  *:focus {
    outline: 4px solid var(--focus-outline-color, black);
    outline-offset: 4px;
    border-radius: 4px;
  }
}
section {
  padding: 5vmin;
  height: 50dvh;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
}
@supports not (height: 50dvh) {
  section {
    height: 50vh;
  }
}
section[data-bg=light] {
  background-color: var(--bg-light);
}
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0