js实现文字背景颜色调整对比效果代码
代码语言:html
所属分类:其他
代码描述:js实现文字背景颜色调整对比效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <style> :root { --bg1: #fd5; --bg2: #fd5; --fg1: #000; --fg2: #fff; } * { box-sizing: border-box; } body { height: 100vh; display: flex; justify-content: center; align-items: center; font: normal 19px/1.5 helvetica, sans-serif; } .container { width: 500px; height: 400px; position: relative; } .top { position: absolute; top: -48px; font-size: 0.7em; } .top h3 { margin: 0; padding: 0; margin-bottom: 0.5em; color: #333; display: inline-block; } .top label { margin-left: 1.15em; } .top input { margin-left: 0.1em; } .bottom { position: relative; width: 500px; height: 400px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .bottom .left, .bottom .right { position: absolute; top: 0; left: 0; height: 400px; overflow: hidden; } .bottom .left .content, .bottom .right .content { width: 500px; padding: 3em; } .bottom .left { width: 50%; max-width: 100%; min-width: 10px; resize: horizontal; z-index: 1; -webkit-animation: demo 4.5s 1; animation: demo 4.5s 1; } .bottom .left .resizable-handle { width: 8px; height: 100%; background: rgba(255, 238, 204, 0.5); border-left: 1px solid rgba(255, 255, 255, 0.75); border-right: 1px solid rgba(0, 0, 0, 0.06125); border-radius: 5px; box-shadow: 0 0 5px rgba(0, 0, 0, 0.06125); transition: all 0.2s; } .bottom .left .resizable-handle:hover { width: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.125); } .bottom .left .resizable-handle-active { width: 13px !important; background: rgba(255, 238, 204, 0.65); } .bottom .left { background: var(--bg1); color: var(--fg1); } .bottom .right { background: var(--bg2); color: var(--fg2); } .bottom h1 { margin-top: 0; } .bottom .small { font-size: 0.75em; } @-webkit-keyframes demo { 12.5% { width: 80%; } 50% { width: 25%; } 80% { width: 50%; } } @keyframes demo { 12.5% { width: 80%; } 50% { width: 25%; } 80% { width: 50%; } } </style> </head> <body> <!-- partial:index.partial.html --> <div class="container"> <div class="top"> <h3>Colors</h3> <label> BG 1: <input type="color" id="bg1" value="#ffdd55" /> </label> <label> Text 1: <input type="color" id="fg1" value="#000000" /> </label> <label> BG 2: <input type="color" id="bg2" value="#ffdd55" /> </label> <label> Text 2: <input type="color" id="fg2" value="#ffffff" /> </label> </div> <div class="bottom"> <div class="left"> <div class="content"> <h1>My Huge Page Title</h1> <p>Sed dapibus neque placerat nisi posuere, et porta nunc aliquam. Quisque at nisi quis mauris condimentum hendrerit a at libero. Nunc vestibulum tellus ut lacus fringilla, eget consectetur justo rhoncus.</p> <p class="small">Aenean consectetur sapien eu congue lobortis. Integer vitae cursus sapien, sed blandit felis.</p> </div> </div> <div class="right"> <div class="conten.........完整代码请登录后点击上方下载按钮下载查看
网友评论0