이제 주로 사용자 경험을 개선하기 위해 단계별 로그인 및 등록 양식이 많이 있습니다. 사용자는 해당 양식 정보를 선택적으로 입력할 수 있으므로 사용자는 여러 양식을 보고 단념하지 않습니다. 오늘 제가 여러분과 공유하는 것은 HTML5와 CSS3를 기반으로 한 단계별 등록 및 로그인 양식입니다. 말할 필요도 없이 매우 아름답습니다. DEMO만 봐도 알 수 있습니다.
여기 온라인 시연이 있습니다. 효과를 먼저 확인하실 수 있습니다.
다음으로 구현 과정을 살펴보겠습니다. 코드는 다소 복잡하며 주로 HTML 코드, CSS3 코드 및 Javascript 코드로 구성됩니다.
HTML 코드:
<form id="msform"> <!-- progressbar --> <ul id="progressbar"> <li>Account Setup</li> <li>Social Profiles</li> <li>Personal Details</li> </ul> <!-- fieldsets --> <fieldset> <h2 id="Create-nbsp-your-nbsp-account">Create your account</h2> <h3 id="This-nbsp-is-nbsp-step-nbsp">This is step 1</h3> <input type="text" name="email" placeholder="Email" /> <input type="password" name="pass" placeholder="Password" /> <input type="password" name="cpass" placeholder="Confirm Password" /> <input type="button" name="next" value="Next" /> </fieldset> <fieldset> <h2 id="Social-nbsp-Profiles">Social Profiles</h2> <h3 id="Your-nbsp-presence-nbsp-on-nbsp-the-nbsp-social-nbsp-network">Your presence on the social network</h3> <input type="text" name="twitter" placeholder="Twitter" /> <input type="text" name="facebook" placeholder="Facebook" /> <input type="text" name="gplus" placeholder="Google Plus" /> <input type="button" name="previous" value="Previous" /> <input type="button" name="next" value="Next" /> </fieldset> <fieldset> <h2 id="Personal-nbsp-Details">Personal Details</h2> <h3 id="We-nbsp-will-nbsp-never-nbsp-sell-nbsp-it">We will never sell it</h3> <input type="text" name="fname" placeholder="First Name" /> <input type="text" name="lname" placeholder="Last Name" /> <input type="text" name="phone" placeholder="Phone" /> <textarea name="address" placeholder="Address"></textarea> <input type="button" name="previous" value="Previous" /> <input type="submit" name="submit" value="Submit" /> </fieldset></form>
HTML 코드는 많이 보이지만 매우 간단하며 주로 양식을 설명합니다.
CSS 코드:
/*form styles*/#msform { width: 400px; margin: 50px auto; text-align: center; position: relative; }#msform fieldset { background: white; border: 0 none; border-radius: 3px; box-shadow: 0 0 15px 1px rgba(0, 0, 0, 0.4); padding: 20px 30px; box-sizing: border-box; width: 80%; margin: 0 10%; /*stacking fieldsets above each other*/ position: absolute; }/*Hide all except first fieldset*/#msform fieldset:not(:first-of-type) { display: none; }/*inputs*/#msform input, #msform textarea { padding: 15px; border: 1px solid #ccc; border-radius: 3px; margin-bottom: 10px; width: 100%; box-sizing: border-box; font-family: montserrat; color: #2C3E50; font-size: 13px; }/*buttons*/#msform .action-button { width: 100px; background: #27AE60; font-weight: bold; color: white; border: 0 none; border-radius: 1px; cursor: pointer; padding: 10px 5px; margin: 10px 5px; }#msform .action-button:hover, #msform .action-button:focus { box-shadow: 0 0 0 2px white, 0 0 0 3px #27AE60; }/*headings*/.fs-title { font-size: 15px; text-transform: uppercase; color: #2C3E50; margin-bottom: 10px; }.fs-subtitle { font-weight: normal; font-size: 13px; color: #666; margin-bottom: 20px; }/*progressbar*/#progressbar { margin-bottom: 30px; overflow: hidden; /*CSS counters to number the steps*/ counter-reset: step; }#progressbar li { list-style-type: none; color: white; text-transform: uppercase; font-size: 9px; width: 33.33%; float: left; position: relative; }#progressbar li:before { content: counter(step); counter-increment: step; width: 20px; line-height: 20px; display: block; font-size: 10px; color: #333; background: white; border-radius: 3px; margin: 0 auto 5px auto; }/*progressbar connectors*/#progressbar li:after { content: ''; width: 100%; height: 2px; background: white; position: absolute; left: -50%; top: 9px; z-index: -1; /*put it behind the numbers*/}#progressbar li:first-child:after { /*connector not needed before the first step*/ content: none; }/*marking active/completed steps green*//*The number of the step and the connector before it = green*/#progressbar li.active:before, #progressbar li.active:after{ background: #27AE60; color: white; }
여기서 양식을 렌더링하기 위한 CSS 코드를 게시했는데, 이는 양식을 매우 신선하고 자연스럽게 보이게 합니다. 주목해야 할 또 다른 점은 여기서 CSS3의 :before 속성을 사용한다는 것입니다.
마지막은 등록 양식의 단계 점프를 구현할 수 있는 Javascript 코드입니다.
Javascript 코드:
var current_fs, next_fs, previous_fs; //fieldsets var left, opacity, scale; //fieldset properties which we will animate var animating; //flag to prevent quick multi-click glitches $(".next").click(function(){ if(animating) return false; animating = true; current_fs = $(this).parent(); next_fs = $(this).parent().next(); //activate next step on progressbar using the index of next_fs $("#progressbar li").eq($("fieldset").index(next_fs)).addClass("active"); //show the next fieldset next_fs.show(); //hide the current fieldset with style current_fs.animate({opacity: 0}, { step: function(now, mx) { //as the opacity of current_fs reduces to 0 - stored in "now" //1. scale current_fs down to 80% scale = 1 - (1 - now) * 0.2; //2. bring next_fs from the right(50%) left = (now * 50)+"%"; //3. increase opacity of next_fs to 1 as it moves in opacity = 1 - now; current_fs.css({'transform': 'scale('+scale+')'}); next_fs.css({'left': left, 'opacity': opacity}); }, duration: 800, complete: function(){ current_fs.hide(); animating = false; }, //this comes from the custom easing plugin easing: 'easeInOutBack' }); }); $(".previous").click(function(){ if(animating) return false; animating = true; current_fs = $(this).parent(); previous_fs = $(this).parent().prev(); //de-activate current step on progressbar $("#progressbar li").eq($("fieldset").index(current_fs)).removeClass("active"); //show the previous fieldset previous_fs.show(); //hide the current fieldset with style current_fs.animate({opacity: 0}, { step: function(now, mx) { //as the opacity of current_fs reduces to 0 - stored in "now" //1. scale previous_fs from 80% to 100% scale = 0.8 + (1 - now) * 0.2; //2. take current_fs to the right(50%) - from 0% left = ((1-now) * 50)+"%"; //3. increase opacity of previous_fs to 1 as it moves in opacity = 1 - now; current_fs.css({'left': left}); previous_fs.css({'transform': 'scale('+scale+')', 'opacity': opacity}); }, duration: 800, complete: function(){ current_fs.hide(); animating = false; }, //this comes from the custom easing plugin easing: 'easeInOutBack' }); }); $(".submit").click(function(){ return false; })
여기서 jQuery 코드를 사용하는 것이 매우 간단하다는 것을 알 수 있습니다. 주로 다음, 이전, 제출의 3가지 이벤트가 있습니다. 동시에 jQuery는 다음 및 이전 이벤트 동안 페이드 인 및 페이드 아웃 애니메이션 효과를 달성하는 데 사용됩니다.
위 내용은 CSS3+html5를 사용하여 단계별 등록 로그인 양식을 구현하는 방법의 예의 상세 내용입니다. 자세한 내용은 PHP 중국어 웹사이트의 기타 관련 기사를 참조하세요!

Goofonts는 개발자 부인과 디자이너 남편이 서명 한 사이드 프로젝트로, 둘 다 타이포그래피의 큰 팬입니다. 우리는 Google에 태그를 지정했습니다

GraphQL API를 구축하는 방법을 배우는 것은 매우 어려울 수 있습니다. 그러나 10 분 안에 GraphQL API를 사용하는 방법을 배울 수 있습니다! 그리고 그것은 완벽하게 얻었습니다

여기 Yuanchuan의 합법적 인 CSS 속임수입니다. 이 CSS 속성 오프셋 경로가 있습니다. 옛날 옛적에, 그것은 모션 경로라고 불렸다가 이름이 바뀌 었습니다. 나


핫 AI 도구

Undresser.AI Undress
사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover
사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

Dreamweaver Mac版
시각적 웹 개발 도구

MinGW - Windows용 미니멀리스트 GNU
이 프로젝트는 osdn.net/projects/mingw로 마이그레이션되는 중입니다. 계속해서 그곳에서 우리를 팔로우할 수 있습니다. MinGW: GCC(GNU Compiler Collection)의 기본 Windows 포트로, 기본 Windows 애플리케이션을 구축하기 위한 무료 배포 가능 가져오기 라이브러리 및 헤더 파일로 C99 기능을 지원하는 MSVC 런타임에 대한 확장이 포함되어 있습니다. 모든 MinGW 소프트웨어는 64비트 Windows 플랫폼에서 실행될 수 있습니다.

Eclipse용 SAP NetWeaver 서버 어댑터
Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.

VSCode Windows 64비트 다운로드
Microsoft에서 출시한 강력한 무료 IDE 편집기

PhpStorm 맥 버전
최신(2018.2.1) 전문 PHP 통합 개발 도구
