css布局实现一个邮票效果代码
代码语言:html
所属分类:布局界面
代码描述:css布局实现一个邮票效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link href="https://fonts.googleapis.com/css?family=Special+Elite&display=swap" rel="stylesheet"> <style> html { box-sizing: border-box; } body { background-color: #fff; height: 100vh; font-family: "URWAgendaW01-Light"; line-height: 1.2; font-weight: 100; margin: 0; overflow: hidden; padding: 0; width: 100vw; } h1, h2, h4, p { font-family: "Special Elite", cursive; } *, *:before, *:after { box-sizing: inherit; } main { background-color: #3e5131; display: flex; justify-content: center; align-items: center; width: 100vw; height: 100vh; } .stamp { border-radius: 4px; width: 300px; height: 380px; position: relative; border-radius: 2px; background-image: radial-gradient(73% 147%, #eadfdf 59%, #eadfdf 100%), radial-gradient(91% 146%, rgba(255, 255, 255, 0.5) 47%, rgba(0, 0, 0, 0.5) 100%); background-blend-mode: screen; } .stamp::after, .stamp::before { content: ""; width: 300px; position: absolute; top: 0; left: 0; background: radial-gradient(circle, #3e5131 50%, transparent 50%), radial-gradient(circle, #3e5131 50%, transparent 50%); background-size: 20px 20px; } .stamp::before { height: 360px; top: 10px; background-repeat: repeat-y; background-position: -4% 0%, 104.2% 0; } .stamp::after { width: 280px; height: 380px; left: 10px; background-repeat: repeat-x; background-position: 0% -3%, 0% 103%; } h1 { color: #af8a32; font-size: 36px; position: absolute; top: 24px; left: 24px; z-index: 2; } h1 span { position: relative; align-self: flex-end; } h1:nth-of-type(2) { font-size: 16px; top: unset; bottom: 24px; } .stamp-deets { position: absolute; right: 24px; color: #af8a32; top: 40px; } .date { color: #af8a32; font-size: 18px; position: absolute; top: 90px; right: 9px; -ms-writing-mode: tb-lr; writing-mode: vertical-lr; } .stamp-frame { position: absolute; top: 0px; right: 0; left: 0; bottom: 0; margin: auto; width: 250px; height: 250px; background-color: #3e5131; box-shadow: inset 0px 0px 0px 4px #af8a32; border-radius: 4px; } .wrapper { background-color: #567144; position: absolute; top: 10px; left: 10px; height: calc(100% - 20px); width: calc(100% - 20px); } .wrapper h1 { display: inline-flex; line-height: 1; padding: 6px; left: 0; top: 0; } .factory { position: absolute; left: 0; height: 100%; overflow: hidden; width: 100%; } .entrance { height: 64px; position: absolute; z-index: 5; bottom: 0px; left: 0; right: 0; margin: auto; width: calc(100% - 25px); width: 100%; } .entrance::after { content: ""; left: -15px; bottom: -2px; position: absolute; width: calc(100% + 30px); height: 4px; } .wall { box-shadow: inset 6px 6px 12px 6px rgba(0, 0, 0, 0.25); width: 21%; height: calc(100% - 28px); position: absolute; bottom: 0; border-style: solid; border-color: #232526; } .wall.is-left { background: linear-gradient(to bottom, #fdfcfb 0%, #3E5131 100%); border-width: 1px 0 0 1px; } .wall.is-right { background: linear-gradient(to bottom, #fdfcfb 0%, #3E5131 100%); right: 0; border-width: 1px 1px 0 0; } .pillar { box-shadow: inset 6px 6px 12px 6px rgba(0, 0, 0, 0.25); width: 9%; height: calc(100% - 7px); position: absolute; bottom: 0; border: 1px solid #232526; border-bottom: 0; } .pillar.is-left { background: linear-gradient(to bottom, #fdfcfb 0%, #3E5131 100%); left: 21%; } .pillar.is-right { background: linear-gradient(to bottom, #fdfcfb 0%, #3E5131 100%); right: 21%; } .gate { box-shadow: inset 1px 12px 9px -6px rgba(249, 243, 230, 0.95); border-radius: 75% 75% 0% 0%/10% 10% 0% 0%; width: 41%; background: linear-gradient(to right, #232526, #414345); height: calc(100% - 14px); left: 29.5%; position: absolute; display: flex; align-items: center; justify-content: center; bottom: 0; z-index: 2; } .gate::after { content: "Guinness"; font-weight: 200; color: #fff; font-size: 14px; bottom: 7px; left: 0; right: 0; margin: auto; position: absolute; text-align: center; opacity: 0.85; width: 100%; } .gate::before { content: ""; background: linear-gradient(to bottom, #B28B67 5.66%, #232526 94.35%); bottom: 0; left: -7px; right: 0; margin: auto; position: absolute; height: 5px; border-radius: 0 0 0 0/4px 4px 4px 4px; transform: skewX(-3deg); width: calc(100% + 14px); border: 1px solid #232526; } .gate .gate-logo { width: 12px; height: 4px; position: absolute; top: 10px; } .bg { border: 1px solid #232526; border-bottom: 0; background: linear-gradient(to bottom, #fdfcfb 0%, #3E5131 100%); height: 96px; position: absolute; z-index: 1; bottom: -3px; left: 0; transform: scale(0.93); display: flex; flex-flow: row nowrap; width: 100%; } .bg.is-faint { transform: scale(1); bottom: -30px; } .bg .bg-roof { background: linear-gradient(to bottom, #fdfcfb 0%, #e2d1c3 100%); border: 1px solid #232526; border-bottom: 0; min-height: 6px; position: absolute; top: -7px; left: 0; width: 100%; transform: scale(1); } .bg .bg-roof::after { content: ""; position: absolute; top: 2px; width: 100%; height: 1px; background-color: #232526; } .bg .windows { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-flow: row dense; grid-column-gap: 24px; grid-row-gap: 6px; height: 100%; padding: 6px 12px; width: 50%; } .bg .windows .window { box-shadow: inset 5px 0px 6px 0px rgba(0, 0, 0, 0.15); display: flex; flex: 1; border: 1px solid #232526; position: relative; } .bg .windows .window::before, .bg .windows .window::after { box-shadow: inset 2px 0px 3px 0px rgba(0, 0, 0, 0.25); content: ""; position: absolute; top: 0; height: 100%; width: 6px; border: 1px solid #232526; } .bg .windows .window::before { border-right: 0; left: -8px; } .bg .windows .window::after { border-left: 0; right: -8px; } .bg .windows .window span { position: absolute; top: 10px; height: 1px; background-color: #232526; width: 100%; } .main-building { position: absolute; z-index: 4; height: 120px; bottom: 35px; left: 0; right: 0; margin: auto; width: calc(100% - 25px); } .main-building .building { background: linear-gradient(to bottom, #fdfcfb 0%, #3E5131 100%); left: 30%; border: 1px solid #232526; position: absolute; box-shadow: inset 6px 6px 12px 6px rgba(0, 0, 0, 0.15); height: 80px; width: 40%; bottom: 0; padding: 6px 9px; padding-bottom: 0; display: flex; align-items: flex-end; z-index: 4; } .main-building .building::after { content: "Guinness"; color: #232526; font-size: 18px; top: 9px; left: 0; right: 0; margin: auto; position: absolute; text-align: center; opacity: 0.75; width: 100%; } .main-building .building::before { content: ""; position: absolute; top: 2px; width: 100%; height: 1px; background-color: #232526; left: 0; } .main-building .building .chimney { height: 50px; top: -50px; width: 15%; left: 3px; } .main-building .building .chimney:nth-of-type(2) { right: 3px; } .main-building .building .building-top-section { position: absolute; height: 60px; top: -68px; width: 30%; left: 35%; background: linear-gradient(to top, #fdfcfb 0%, #3E5131 100%); border: 1px solid #232526; } .main-building .building .building-top-section::before { content: ""; position: absolute; top: 3px; width: 100%; height: 1px; background-color: #2f3233; left: 0; } .main-building .building .building-top-section .vats { display: grid; width: 100%; grid-template-columns: 18px; justify-content: center; flex-flow: row nowrap; grid-auto-flow: row dense; position: absolute; bottom: 10px; height: calc(100% - 35px); } .main-building .building .building-top-section .vats .vat { margin-top: auto; height: 30px; } .main-building .building .pipe { position: absolute; height: 6px; top: -45px; width: 50%; left: 23%; background: linear-gradient(to bottom, #fdfcfb 0%, #3E5131 100%); border: 1px solid #232526; border-radius: 4px; } .main-building .building .building-top-section-top { background: linear-gradient(to bottom, #fdfcfb 0%, #3E5131 100%); border: 1px solid #232526; box-shadow: inset 6px 6px 12px 6px rgba(0, 0, 0, 0.1); position: absolute; height: 16px; top: -83px; width: 18%; left: 41%; } .main-building .building .building-top-section-top::before { content: ""; position: absolute; top: 2px; width: 100%; height: 1px; background-color: #232526; left: 0; } .main-building .building.is-middle { left: 20%; border: 1px solid #232526; bottom: -6px; height: 70px; width: 60%; z-index: 3; } .main-building .building.is-middle::after { content: ""; } .main-building .building.is-middle .chimney { height: 28px; width: 9%; left: 6px; top: -28px; } .main-building .building.is-middle .chimney:nth-of-type(2) { left: initial; right: 6px; } .main-building .building.is-back { left: 6%; border: 1px solid #232526; z-index: 2; height: 60px; width: calc(100% - 12%); bottom: -6px; } .main-building .building.is-back::after { content: ""; } .main-building .building.is-back .chimney { height: 85px; width: 9%; left: 7px; top: -85px; } .main-building .building.is-back .chimney:nth-of-type(2) { left: initial; right: 7px; } .main-building .chimney { border-radius: 20% 20% 10% 10%/94% 95% 0% 0%; position: absolute; width: 9%; border: 1px solid #232526; background: linear-gradient(-20deg, #616161 0%, #3E5131 100%); } .main-building .chimney:nth-of-type(2) { left: initial; right: 7px; } .main-building .chimney::after { content: ""; top: -2px; position: absolute; left: 0; right: 0; margin: 0 auto; height: 4px; border-radius: 35% 35% 10% 10%/46% 45% 0% 0%; box-shadow: 0 3px 5px rgba(62, 81, 49, 0.6); background: #2f3233; width: 8px; } .vats { display: grid; width: 100%; grid-template-columns: repeat(3, 1fr); flex-flow: row nowrap; grid-auto-flow: row dense; grid-column-gap: 4px; height: calc(100% - 35px); } .vat { background: linear-gradient(to left, #d7d2cc 0%, #304352 100%); box-shadow: inset 6px 6px 12px 6px rgba(0, 0, 0, 0.25); border: 1px solid #26311e; border-radius: 4px; } .vat:nth-of-type(2) { background: linear-gradient(to right, #d7d2cc 0%, #304352 100%); } .cloud { position: absolute; width: 70px; height: 24px; right: 6px; background-image: linear-gradient(to top, #f3e7e9 0%, #e3eeff 99%, #e3eeff 100%); border-radius: 20px; top: 20px; transform: scale(0.5); box-shadow: 0 3px 5px rgba(62, 81, 49, 0.6); } .cloud:first-of-type { left: 30px; right: unset; top: 30px; } .cloud::before, .cloud::after { content: ""; background-image: linear-gradient(to top, #f3e7e9 0%, #e3eeff 99%, #e3eeff 100%); width: 36px; height: 36px; top: -18px; right: 10px; position: absolute; border-radius: 40px; } .cloud::before { width: 36px; height: 36px; top: -18px; right: 10px; border-radius: 40px; } .cloud::after { width: 20px; height: 20px; top: -10px; left: 10px; border-radius: 20px; } </style> </head> <body> <main> <div class="stamp"> <h1> Éire </h1> <!-- <h4 class="stamp-deets"> 15 / 28 </h4> --> <h4 class="date"> 2020 </h4> <div class="stamp-frame"> <div class="wrapper"> <div class="cloud"></div> <div class="cloud"></div> <h1> 1 <span>€ </span> </h1> <div class="factory"> <div class="entrance"> <div class="wall is-left"></div> <div class="wall is-right"></div> <div class="gate"> <div class="gate-logo"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 392.5 484.5"> <defs /> <linearGradient id="a" x1="390.3959" x2="2.7397" y1="242.8118" y2="242.8118" gradientUnits="userSpaceOnUse"> <stop offset=".287" stop-color="#c09757" /> <stop offset=".3326" stop-color="#c29b5c" /> <stop offset=".3976" stop-color="#caa46a" /> <stop offset=".4743" stop-color="#d6b481" /> <stop offset=".5592" stop-color="#e9cda4" /> <stop offset=".6047" stop-color="#f6debc" /> <stop offset=".6358" stop-color="#efd4af" /> <stop offset=".7738" stop-color="#d4b17d" /> <stop offset=".8757" stop-color="#c59e62" /> <stop offset=".9295" stop-color="#c09757" /> </linearGradient> <path fill="url(#a)" d="M205.7 82.7c6.5-2.5 13-5.1 19.5-7.1 2.3.4 4.7.9 7.2 1.2-8.4 1.8-17.1 5.3-25.6 8.6-.4.1-1.1.4-1.5.6-1.3-.6-2.6-1.1-3.9-1.7 1.3-.5 3-1.1 4.3-1.6zm0-10.1c-5.2 2.1-11.3 4.5-16.6 6.2 1.3.6 2.7 1.2 4 1.8 4.4-1.5 9.5-3.6 13.7-5.2 2-.8 4.1-1.6 6.1-2.4-1.7-.4-3.5-.8-5.1-1.3l-2.1.9zm-86.4 63.5l6.6-15.1 24.4-55.6c-1.5-.7-3-1.5-4.5-2.2l-23.9 54.5c-1.5-3.3-2.9-6.6-4.3-9.7l-4 2.4c1.8 4.1 3.8 8.5 5.8 13l-2.8 6.4 2.7 6.3zm55.4-63.9c1.6.7 3.2 1.5 4.8 2.2 5.6-1.2 12.3-3.3 17.9-5.4-1.7-.5-3.3-1-4.9-1.5-5.7 2-12.3 3.9-17.8 4.7zm-16.6 334.1c.7 1.9 3.5 3.3 6.5 2.2 2.9-1 4.4-3.4 3.5-5.8-.5-1.5-2.9-4.1-6.8-2.7-3.6 1.3-4 4.2-3.2 6.3zM131.5 309c2.9-1 3.9-3 3.4-4.3l-1-2.7-8.9 3.2 1 2.9c.5 1.5 2.8 1.9 5.5.9zm90.6 19.2l-3.6 2.2c9.7 13.6 20.2 23.8 29.8 24-8.9-4.3-18-14.5-26.2-26.2zm-21.2-12.7l7.8-17.9 80.5-183.4c-1.7-.2-3.5-.3-5.2-.5l-80.4 183.1c-1.5-3-2.9-5.7-4.1-8.2l-4 2.4c.9 1.9.4.8 1 2 1.5 2.9 3.1 6 4.7 9.1l-3.4 7.8c1 1.9 2 3.7 3.1 5.6zM244 95.6c10.6 0 21.2 4.7 32.4 9.7 2.5 1.1 4.4 2 7 3.1 3.3.3 6.7.5 10 .6-5.8-1.9-10.1-3.9-15.8-6.4-11-4.9-22.4-10-33.6-10-5.2 0-10.7 1.1-16.1 2.5 1.7.6 3.5 1.3 5.3 1.9 3.6-.8 7.3-1.4 10.8-1.4zM360.4 93c22.5 172.1-51.9 264.8-86.9 311.6-27.8 36.2-29.8 52.2-19.9 67.7-36.4 15.7-68.6 7.2-80.9 4.6-4.9-6.4-7.2-12.4-9.3-18l8.4-.3s1.8 3.5 3.5 6.7c9.8-1.3 20.4-5.4 30.7-9.5l1.5-.6c1.7-3 3.7-6 5.8-9.1-1.9.7-4.3 1.7-6.2 2.4-11.8 4.7-24 9.5-35.3 10.1v-.1c1.3-1.1 2.6-2.2 3.8-3.3 9.8-1.3 20.3-5.5 30.4-9.5 3.3-1.3 7.2-2.8 10.5-4.1 2.3-3.1 4.8-6.2 7.5-9.4-5.3 1.7-11.7 4.1-16.9 6.2-6.8 2.7-13.8 5.5-20.7 7.4 2-1.7 3.9-3.4 5.8-5 4.6-1.6 9.2-3.4 13.8-5.2 6.8-2.7 14.8-5.7 21.7-7.7 2.5-2.9 5.1-5.9 7.9-8.9-9 1.7-19.3 5.7-28.4 9.3-.3.1-.6.2-.9.4 2.4-2.1 4.7-4.1.........完整代码请登录后点击上方下载按钮下载查看
网友评论0