css实现弧形头部效果
代码语言:html
所属分类:菜单导航
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Responsive Curved Header with SVG</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <style> @keyframes fadeIn { to { opacity: 1; transform: translateY(0); } } html, body { height: 100%; margin: 0; padding: 0; } .fadeInClass { animation: fadeIn 1s ease-out forwards; } .text-center { text-align: center; } .text-2 { font-size: 1.8rem; } .margin-bottom--3 { margin-bottom: 3rem; } .margin-y--5 { margin-top: 5rem; margin-bottom: 5rem; } .page-container { max-width: 100%; margin: 60px auto 0; background: white; } .content-container { width: 726px; margin: 0 auto; } @media (max-width: 726px) { .content-container { width: 100%; padding: 0 1rem; } } .navbar { width: 100%; height: 60px; box-shadow: 0px 3px 3px rgba(0, 0, 0, 0.11); position: fixed; top: 0; z-index: 1000; background: white; } .banner { height: 368px; overflow: hidden; position: relative; } @media (max-width: 726px) { .banner { height: 300px; } } @media (max-width: 400px) { .banner { height: 200px; } } .banner .banner_img-wrapper { position: relative; width: 100%; height: 99%; display: block; } .banner .banner_img-wrapper:after { display: block; position: absolute; bottom: 0; left: 0; right: 0; opacity: .7; content: ""; width: 100%; height: 100%; background-image: linear-gradient(165deg, #00274C, #445339, #FFCB05); } .banner .banner_text { margin: -288px auto 0; max-width: 726px; position: relative; color: white; opacity: 0; transform: translateY(5px); animation: fadeIn 1s ease-out forwards; } @media (max-width: 726px) { .banner .banner_text { margin: -240px auto 0; padding: 0 1rem; } } @media (max-width: 400px) { .banner .banner_text { margin: -190px auto 0; text-align: center; } } .banner .banner_img { height: 100%; width: 100%; object-fit: cover; object-position: center 10%; } .banner .curve-mask { position: absolute; bottom: 0; left: 0; right: 0; width: 100%; height: 7vw; } .subject-links { padding-left: 0; list-style: none; display: flex; justify-content: center; flex-wrap: wrap; } .how-it-works { display: flex; justify-content: center; } .how-it-works .plus { margin-top: 2rem; } .how-it-works section { max-width: 30%; text-align: center; } .btn { padding: .5rem 1rem; border-radius: 25px; height: 30px; text-decoration: none; color: #00274C; } .btn-white { background: white; } .btn-shadow { box-shadow: 0px 0px 30px 3px rgba(0, 0, 0, 0.11); } .btn-subject { display: flex; justify-content: center; align-items: center; min-width: 144px; padding: .5rem; margin: .5rem; } </style> </head> <body translate="no"> <nav class="navbar"></nav> <div class="page-container"> <div class="banner"> <div class="banner_img-wrapper"> <img class="banner_img" src="https://ssw.umich.edu/sites/all/themes/ssw/images/ssw-meta-og-image.jpg" alt="5 women smiling and laughing, wearing School of Social Work t-shirts"> </div> <div class="banner_text"> <h1>#HereToLearn</h1> <p>Find out what motivates our students</p> <a href="#" class="btn btn-white btn-shadow">Learn more</a> </div> <svg class="curve-mask" preserveAspectRatio="none" viewBox="0 0 1024 96" xmlns="http://www.w3.org/2000/svg"> <g id="Curve-Experiments" fill="none" fill-rule="evenodd"> <g id="Curve-A" transform="translate(0 -349)" fill="#FFF" fill-rule="nonzero"> <path d="M0 398.663c470.834 145.75 491.222-163.652 1024 0v46.08H0v-46.08z" id="mo-curve" /> </g> </g> </svg> </div> <div class="content-container"> <p class="text-center text-2 margin-y--5"> Michigan Online is your gateway to online learning opportunities with the University of Michigan </p> <ul class="subject-links" data-scroll-point-1> <li class="subject-link"><a href="#" class="btn btn-white btn-shadow btn-subject">Arts & Culture</a></li> <li class="subject-link"><a href="#" class="btn btn-white btn-shadow btn-subject">Business</a></li> <li class="subject-link"><a href="#" class="btn btn-white btn-shadow btn-subject">Data Science</a></li> <li class="subject-link"><a href="#" class="btn btn-white btn-shadow btn-subject">Education</a></li> <li class="subject-link"><a href="#" class="btn btn-white btn-shadow btn-subject">Health</a></li> <li class="subject-link"><a href="#" class="btn btn-white btn-shadow btn-subject">Technology</a></li> <li class="subject-link"><a href="#" class="btn btn-white btn-shadow btn-subject">Science</a></li> <li class="subject-link"><a href="#" class="btn btn-white btn-shadow btn-subject">Social Sciences</a></li> </ul> <section class="margin-y--5"> <h2 class="text-center margin-bottom--3">How It Works</h2> <div class="how-it-works"> <section data-target-hiw-1 class="how-it-works__col-1"> <svg width="84" height="85" viewBox=&q.........完整代码请登录后点击上方下载按钮下载查看
网友评论0