效果演示
具有视觉吸引力的菜单选项
HTML
<div class="card"><ul><li class="iso-pro"><span></span><span></span><span></span><a href=""><svgviewBox="0 0 320 512"xmlns="http://www.w3.org/2000/svg"class="svg"><pathd="M279.14 288l14.22-92.66h-88.91v-60.13c0-25.35 12.42-50.06 52.24-50.06h40.42V6.26S260.43 0 225.36 0c-73.22 0-121.08 44.38-121.08 124.72v70.62H22.89V288h81.39v224h100.17V288z"></path></svg></a><div class="text">Facebook</div></li><li class="iso-pro"><span></span><span></span><span></span><a href=""><svgclass="svg"xmlns="http://www.w3.org/2000/svg"viewBox="0 0 512 512"><pathd="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path></svg></a><div class="text">Twitter</div></li><li class="iso-pro"><span></span><span></span><span></span><a href=""><svgclass="svg"xmlns="http://www.w3.org/2000/svg"viewBox="0 0 448 512"><pathd="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path></svg></a><div class="text">Instagram</div></li></ul>
</div>
- card:最外层的容器,用于包裹整个卡片。
- ul:无序列表,用于垂直排列列表项。
- iso-pro:列表项,每个列表项代表一个社交媒体图标。
- span:用于创建等边三角形,通过CSS进行样式设置,用于实现等角投影效果。
- a:锚点标签,用于链接到外部页面,这里没有指定链接地址。
- svg:SVG图形标签,包含路径数据,用于显示社交媒体图标。
- text:包含社交媒体名称的文本。
CSS
.card {max-width: fit-content;border-radius: 15px;display: flex;flex-direction: column;align-content: center;justify-content: center;gap: 1rem;backdrop-filter: blur(15px);box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.192),inset 0 0 5px rgba(255, 255, 255, 0.274), 0 5px 5px rgba(0, 0, 0, 0.164);transition: 0.5s;
}.card:hover {animation: ease-out 5s;background: rgba(173, 173, 173, 0.05);
}.card ul {padding: 1rem;display: flex;list-style: none;gap: 1rem;align-items: center;justify-content: center;align-content: center;flex-wrap: wrap;flex-direction: column;
}.card ul li {cursor: pointer;
}.svg {transition: all 0.3s;/* if you find some problems change w - h : 30px*/padding: 1rem;height: 60px;width: 60px;border-radius: 100%;color: rgb(255, 174, 0);fill: currentColor;box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.3),inset 0 0 5px rgba(255, 255, 255, 0.5), 0 5px 5px rgba(0, 0, 0, 0.164);
}.text {opacity: 0;border-radius: 5px;padding: 5px;transition: all 0.3s;color: rgb(255, 174, 0);background-color: rgba(255, 255, 255, 0.3);position: absolute;z-index: 9999;box-shadow: -5px 0 1px rgba(153, 153, 153, 0.2),-10px 0 1px rgba(153, 153, 153, 0.2),inset 0 0 20px rgba(255, 255, 255, 0.3),inset 0 0 5px rgba(255, 255, 255, 0.5), 0 5px 5px rgba(0, 0, 0, 0.082);
}/*isometric prooyection*/
.iso-pro {transition: 0.5s;
}
.iso-pro:hover a > .svg {transform: translate(15px, -15px);border-radius: 100%;
}.iso-pro:hover .text {opacity: 1;transform: translate(25px, -2px) skew(-5deg);
}.iso-pro:hover .svg {transform: translate(5px, -5px);
}.iso-pro span {opacity: 0;position: absolute;color: #1877f2;border-color: #1877f2;box-shadow: inset 0 0 20px rgba(255, 255, 255, 0.3),inset 0 0 5px rgba(255, 255, 255, 0.5), 0 5px 5px rgba(0, 0, 0, 0.164);border-radius: 50%;transition: all 0.3s;height: 60px;width: 60px;
}.iso-pro:hover span {opacity: 1;
}.iso-pro:hover span:nth-child(1) {opacity: 0.2;
}.iso-pro:hover span:nth-child(2) {opacity: 0.4;transform: translate(5px, -5px);
}.iso-pro:hover span:nth-child(3) {opacity: 0.6;transform: translate(10px, -10px);
}
- .card:设置卡片的最大宽度、边框半径、显示方式等。
- .card:hover:设置鼠标悬停时的背景和动画效果。
- .card ul:设置列表的内边距、显示方式、列表项间隔等。
- .card ul li:设置列表项的光标样式。
- .svg:设置SVG图标的过渡效果、填充色、边框半径等。
- .text:设置文本的初始透明度、边框半径、填充色等。
- .iso-pro:设置等角投影效果的过渡效果。
- .iso-pro:hover:设置鼠标悬停在列表项上时的变换效果,包括SVG图标和文本的移动和透明度变化。
- .iso-pro span:设置用于等角投影的span元素的初始样式。
- .iso-pro:hover span:设置鼠标悬停在列表项上时span元素的透明度变化。