css实现图片悬浮弹出文字提示效果代码
代码语言:html
所属分类:悬停
代码描述:css实现图片悬浮弹出文字提示效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/reset.min.css"> <style> *, *:before, *:after { box-sizing: border-box; } * { -webkit-tap-highlight-color: rgba(0, 0, 0, 0); transform-style: preserve-3d; } *:focus { outline: none !important; } body, html { height: 100%; } body { height: 100%; font-family: faune, fantasy; } .photo-grid { position: relative; font-style: italic; } .photo-grid ul { display: grid; grid-template-columns: 1fr; list-style: none; } .photo-grid ul li { width: 100%; overflow: hidden; } .photo-grid figure, .photo-grid picture, .photo-grid img { display: block; max-width: 100%; } .photo-grid figure { position: relative; } .photo-grid figcaption { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .photo-grid fieldset { display: flex; align-items: flex-end; justify-content: flex-end; width: 100%; height: 100%; padding: 3px; } .photo-grid .photo-close { position: absolute; top: 0; left: 0; z-index: 1; width: 100%; height: 100%; } .photo-grid label, .photo-grid .photo-link { cursor: pointer; } .photo-grid .photo-link { will-change: opacity; display: block; position: relative; z-index: 1; padding: 3px; } .photo-grid .icon { display: block; width: 25px; height: 25px; } .photo-grid .icon group, .photo-grid .icon path, .photo-grid .icon polyline, .photo-grid .icon polygon, .photo-grid .icon circle, .photo-grid .icon ellipse, .photo-grid .icon rect { fill: none; fill-rule: evenodd; stroke: white; stroke-width: 7px; stroke-linecap: round; stroke-linejoin: round; } .photo-grid input { display: none; } .photo-grid input ~ label.photo-link { display: none; } .photo-grid input:hover ~ dl{ transform: none; opacity: 1; z-index: 2; } .photo-grid input:checked ~ dl { transform: none; opacity: 1; z-index: 2; } .photo-grid input:checked ~ .photo-close { z-index: unset; } .photo-grid input:checked ~ label.photo-link { opacity: 0; } .photo-grid dl { transform: translateY(25%); opacity: 0; z-index: 0; transition: all 0.3s ease-out; will-change: opacity, transform; position: absolute; bottom: 0; left: 0; width: 100%; padding: 12px; font-size: 24px; color: white; background-color: rgba(17, 23, 26, 0.9); } .photo-grid dl label, .photo-grid dl .photo-link { position: absolute; right: 0; z-index: 1; padding: 6px; } .photo-grid dl label { top: 0; } .photo-grid dl .photo-link { bottom: 0; } .photo-grid dl div { position: relative; z-index: 0; } .photo-grid dl dt, .photo-grid dl dd { display: inline; } .photo-grid dl dt { opacity: 0.7; font-weight: bold; } .photo-grid dl dt:after { content: ": "; } @supports (-webkit-backdrop-filter: blur(10px)) { .photo-grid dl { background-color: rgba(17, 23, 26, 0.4); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); } } @media only screen and (min-width: 600px) { .photo-grid input ~ label.photo-link { opacity: 0; } .photo-grid li:hover input ~ label.photo-link { opacity: 1; } .photo-grid li:hover input:checked ~ label.photo-link { opacity: 0; } .photo-grid i.........完整代码请登录后点击上方下载按钮下载查看
网友评论0