div+css布局实现背景背光的键盘效果代码
代码语言:html
所属分类:布局界面
代码描述:div+css布局实现背景背光的键盘效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> /* General Styling */ * { box-sizing: border-box; margin: 0; padding: 0; } body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #f7e4d1, #f2d3c4); font-family: Arial, sans-serif; color: #222; } .keyboard-frame { background: #fff0db; /* Soft vintage color */ padding: 45px 25px 25px 25px; /* Space around the keyboard for the RGB glow */ border-radius: 30px; /* Extra rounded corners */ box-shadow: 0 0 5px rgba(255, 255, 255, .7), /* Soft outer glow */ 0 5px 15px rgba(255, 255, 255, .5), /* Bright jelly effect */ 0 10px 25px rgba(0, 0, 0, 0.5); /* Subtle depth shadow */ position: relative; transform: translateY(-5px); /* Lift the frame slightly */ } .keyboard-frame::before { content: ''; position: absolute; top: 3%; /* Adjusted for the inner glossy effect */ left: 1%; /* Adjusted for the inner glossy effect */ right: 1%; /* Adjusted for the inner glossy effect */ bottom: 3%; /* Adjusted for the inner glossy effect */ border-radius: 20px; /* Match frame shape */ background: rgba(255, 255, 255, 0.3); /* Higher opacity for gloss */ z-index: 0; pointer-events: none; } /* Keyboard Base */ .keyboard { background: rgba(255, 230, 180, 0.9); /* Slightly darker color for keys */ padding: 6px; border-radius: 6px; display: flex; flex-direction: column; gap: 0px; position: relative; max-width: 850px; overflow: hidden; } /* Unified RGB Glow */ .keyboard::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: 20px; background: linear-gradient(90deg, rgba(255, 200, 0, 0.6), rgba(0, 230, 100, 0.6), rgba(0, 180, 255, 0.6), rgba(130, 30, 200, 0.6), rgba(255, 90, 150, 0.6)); /* Adjusted for a darker tone */ filter: blur(2px); } /* Key Row Styling */ .key-row { display: flex; gap: 0px; justify-content: space-between; } /* Key Styling */ .key { font-family: 'Roboto Condensed', sans-serif; font-size: 12px; font-weight: bold; /* Ensure the font is bold */ background: #eed9c4; /* Slightly darker color for keys */ color: #000; /* Change key text color to black */ width: 55px; height: 50px; border-radius: 3px; /* Round shape for Cherry keycaps */ display: flex; align-items: center; justify-content: center; text-shadow: none; /* No shadow for clarity */ position: relative; z-index: 1; transform: rotateX(10deg); /* 3D perspective for each key */ box-shadow: inset 0px 1px 2px rgba(255, 255, 255, 1), /* Top inner highlight */ inset 0px -4px 6px rgba(0, 0, 0, 0.4), /* Darker bottom shadow for depth */ 0px 6px 10px rgba(0, 0, 0, 0.4); /* Drop shadow below */ } /* Glossy Overlay Effect for Keys */ .key::after { content: ''; position: absolute; top: 10%; left: 10%; right: 10%; bottom: 20%; background: linear-gradient(to top, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)); /* Jelly effect using a lighter background */ border-radius: 5px; /* Match the key shape */ z-index: 0; } /* Add glossy effect to the key itself */ .key::before { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: 4px; /* Match the key shape */ background: linear-gradient(to bottom, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0)); /* Glossy effect */ z-index: 3; /* Above other layers */ pointer-events: none; /* Allow clicks through the glossy layer */ } /* Specific Bottom Shadow Colors with Softer Baby Tones */ .key:nth-child(1) { box-shadow: 0 4px 10px rgba(255, 210, 150, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Orange shadow */ .key:nth-child(2) { box-shadow: 0 4px 10px rgba(255, 250, 200, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Yellow shadow */ .key:nth-child(3) { box-shadow: 0 4px 10px rgba(200, 255, 200, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Light Green shadow */ .key:nth-child(4) { box-shadow: 0 4px 10px rgba(180, 180, 255, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Light Purple shadow */ .key:nth-child(5) { box-shadow: 0 4px 10px rgba(255, 220, 230, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Pink shadow */ .key:nth-child(6) { box-shadow: 0 4px 10px rgba(200, 255, 200, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Light Green shadow */ .key:nth-child(7) { box-shadow: 0 4px 10px rgba(180, 220, 255, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Light Cyan shadow */ .key:nth-child(8) { box-shadow: 0 4px 10px rgba(180, 220, 255, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Light Cyan shadow */ .key:nth-child(9) { box-shadow: 0 4px 10px rgba(180, 220, 255, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Light Cyan shadow */ .key:nth-child(10) { box-shadow: 0 4px 10px rgba(180, 150, 255, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Light Purple shadow */ .key:nth-child(11) { box-shadow: 0 4px 10px rgba(180, 150, 255, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Light Purple shadow */ .key:nth-child(12) { box-shadow: 0 4px 10px rgba(180, 150, 255, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Light Purple shadow */ .key:nth-child(13) { box-shadow: 0 4px 10px rgba(255, 220, 240, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Light Pink shadow */ .key:nth-child(14) { box-shadow: 0 4px 10px rgba(255, 220, 240, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Light Pink shadow */ .key:nth-child(15) { box-shadow: 0 4px 10px rgba(255, 220, 240, 0.5), inset 0 0 0 rgba(0, 0, 0, 0.3); } /* Very Soft Light Pink shadow */ /* Key Sizes for Justification */ .key-wide { width: 75px; bo.........完整代码请登录后点击上方下载按钮下载查看
网友评论0