• <label id="ci8ol"></label>
    <li id="ci8ol"><legend id="ci8ol"></legend></li>
      1. <rt id="ci8ol"><noframes id="ci8ol">
      2. \r\n    \r\n        \r\n            \r\n            <\/p>\r\n            \r\n            <\/p>\r\n        <\/p>\r\n        用戶登錄<\/h4>\r\n        \r\n            \r\n                \r\n                用戶名<\/label>\r\n            <\/p>\r\n            \r\n                \r\n                密 碼<\/label>\r\n            <\/p>\r\n            \r\n                忘記密碼<\/a><\/p>\r\n                \r\n                    <\/span>\r\n                    記住密碼<\/label>\r\n                <\/p>\r\n            <\/p>\r\n        <\/p>\r\n        \r\n            <\/span>\r\n        <\/button>\r\n    <\/p>\r\n<\/body>\r\n

        国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

        Home Web Front-end CSS Tutorial Create a material-design style login interface example with CSS3

        Create a material-design style login interface example with CSS3

        Feb 25, 2017 pm 03:19 PM

        This article mainly introduces the use of CSS3 to create a material-design style login interface example. It has certain reference value. You can learn more if you need it.

        On a whim, I wanted to learn the design style of material design, so I tried to complete the production of a login page.

        This is the overall effect.

        CSS3 制作一個(gè)material-design 風(fēng)格登錄界面實(shí)例

        ## It feels pretty good, the code will be attached at the end

        During the writing process, no pictures or font icons were used. All was completed using css3. I still encountered some difficulties and bugs, so I wanted to write them down. It will be easy to refer to later.

        Responsive design

        In this page, use the following 3 points to complete the responsive design

        1. Maximum width. A maximum width of max-width is set to ensure compatibility with large screens.

        2. Margin: 20px auto; to keep it centered at all times

        3. Components use pixels

        There are many more points about responsive design.

        Overall page layout

        <!DOCTYPE html>
        <html lang="en">
        
        <head>
            <meta charset="UTF-8">
            <title>Document</title>
            <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <link rel="stylesheet" href="styles/style.css">
        </head>
        
        <body>
            <p class="container">
                <p class="logo">
                    <p class="logo-block-top">
                    </p>
                    <p class="logo-block-bottom">
                    </p>
                </p>
                <h4 class="login-header">用戶登錄</h4>
                <p class="content">
                    <p class="form-group">
                        <input type="text" required class="form-control">
                        <label class="form-label">用戶名</label>
                    </p>
                    <p class="form-group">
                        <input type="text" required class="form-control">
                        <label class="form-label">密 碼</label>
                    </p>
                    <p class="option">
                        <p class="option-left"><a href="">忘記密碼</a></p>
                        <p class="option-right">
                            <span class="md-checkbox" checked="checked"></span>
                            <label class="form-label">記住密碼</label>
                        </p>
                    </p>
                </p>
                <button class="login-button">
                    <span class="icon-login"></span>
                </button>
            </p>
        </body>
        <script src="./app.js type=" text/javascript "></script>
        
        </html>

        ##CSS Start

        to body Add style

        html {
            font-family: "Microsoft YaHei", ?????“, "Segoe UI", "Lucida Grande", Helvetica, Arial, sans-serif, FreeSans, Arimo;
            background-color: #FF4081;
            color: #777;
        }

        Heart

        .container{
            position: relative;
            max-width: 360px;
            margin: 0 auto;
            margin-top: 30px;
            padding: 45px 20px;
            border-radius: 4px;
            box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.3);
            background-color: #fff;
            box-sizing: border-box;
        }

        Note that the internal margins are adjusted here using Padding instead of using margin for child elements, because if you want to use margin, for the BFC effect, you need to add overflow: hidden. This will affect the overflow of the tail button.

        Head logo

        .container>.logo {
            height: 150px;
            width: 150px;
            position: relative;
            background-color: #EFEFEF;
            border-radius: 75px;
            margin: 0 auto;
        }

        Set border-radius to normal width and height, which will make it a circle

        CSS3 制作一個(gè)material-design 風(fēng)格登錄界面實(shí)例The following requires a darker semicircle

        How to draw a semicircle?

        .container>.logo::after {
            content: &#39; &#39;;
            height: 150px;
            width: 75px;
            position: absolute;
            background-color: #E1E1E1;
            border-radius: 0 75px 75px 0;
            left: 75px;
            top: 0;
        }

        Set the width to the height. Then set the upper left corner and lower left corner rounded corners to 0, and the right corner to 75px

        CSS3 制作一個(gè)material-design 風(fēng)格登錄界面實(shí)例Make a lock, divided into two parts, lock-top and lock-bottom

        .container>.logo>.logo-block-top {
            box-sizing: border-box;
            height: 45px;
            width: 54px;
            border: 10px solid #F57C00;
            border-bottom: 0;
            position: absolute;
            border-radius: 27px 27px 0 0;
            left: 48px;
            z-index: 1001;
            top: 20px;
        }

        Similarly set the rounded corners

        .container>.logo>.logo-block-bottom {
            position: absolute;
            height: 60px;
            width: 80px;
            box-sizing: border-box;
            background-color: #FFA000;
            z-index: 1001;
            top: 65px;
            left: 35px;
            border-radius: 7px;
        }

        CSS3 制作一個(gè)material-design 風(fēng)格登錄界面實(shí)例Set the key heart , this is also divided into two parts, the upper round hole and the lower ellipse

        can just be set on the before and after pseudo-elements of lock-bottom

        .container>.logo>.logo-block-bottom::before {
            content: " ";
            position: absolute;
            height: 12px;
            width: 12px;
            background-color: #EFEFEF;
            border-radius: 5px;
            top: 22px;
            left: 34px;
            box-sizing: border-box;
        }
        .container>.logo>.logo-block-bottom::after {
            content: " ";
            position: absolute;
            height: 12px;
            width: 6px;
            background-color: #EFEFEF;
            border-radius: 2px;
            top: 30px;
            left: 37px;
            box-sizing: border-box;
        }

        The logo is complete here

        CSS3 制作一個(gè)material-design 風(fēng)格登錄界面實(shí)例 The following is the 'User Login' title.

        Note, it is best to use margin here instead of padding, do not destroy the original h4 tag.

        .container>.login-header {
            text-align: center;
            font-size: 23px;
            color: #FF4081;
            font-weight: 400;
            margin: 15px 0 18px 0;
        }

        Add a container for the content

        .container>.content {
            width: 90%;
            margin: 0 auto;
        }

        Add a form-group, including label and input tags, set the relative layout

        .container>.content>.form-group {
            position: relative;
        }

        The following is the core part, set the style for the input (this will generate a bug, will be introduced at the end)

        .container>.content>.form-group>.form-control {
            z-index: 3;
            position: relative;
            height: 58px;
            width: 100%;
            border: 0px;
            border-bottom: 1px solid #777;
            padding-top: 22px;
            color: #FF4081;
            font-size: 12px;
            background: none;
            box-sizing: border-box;
            outline: none;
            display: inline-block;
            -webkit-transition: 0.3s;
            transition: 0.3s;
        }

        labe label, use absolute positioning, and place it above the Input.

        .container>.content>.form-group>.form-label {
            z-index: 1;
            position: absolute;
            bottom: 10px;
            left: 0;
            font-size: 15px;
            -webkit-transition: 0.3s;
            transition: 0.3s;
        }

        Set a certain distance between the two form groups, otherwise the lower part will block the box-shadow set above

        .container>.content>.form-group>:first-child {
            margin-bottom: 5px;
        }

        Add Dynamic effect

        .container>.content>.form-group>.form-control:focus,
        .container>.content>.form-group>.form-control:valid {
            box-shadow: 0 1px #FF4081;
            border-color: #FF4081;
        }
        
        .container>.content>.form-group>.form-control:focus+.form-label,
        .container>.content>.form-group>.form-control:valid+.form-label {
            font-size: 12px;
            -ms-transform: translateY(-20px);
            -webkit-transform: translateY(-20px);
            transform: translateY(-25px);
        }

        Now comes the bottom option, which is also divided into two parts, option-left and option-right

        .container>.content>.option {
            width: 100%;
            height: 14px;
            margin-top: 24px;
            font-size: 16px;
        }
        
        .container>.content>.option>.option-left {
            width: 50%;
            float: left;
        }
        
        .container>.content>.option>.option-left>a,
        .container>.content>.option>.option-left>a:hover {
            color: #FF4081;
            text-decoration: none;
        }

        In option-right, please note that this checkbox is not a native Input, but is rotated using p, because the native checkbox cannot change the style.

        .container>.content>.option>.option-right {
            width: 50%;
            float: right;
            text-align: right;
            position: relative;
        }
        
        .container>.content>.option>.option-right>.md-checkbox {
            height: 18px;
            width: 18px;
            display: inline-block;
            box-sizing: border-box;
            position: absolute;
            background-color: #FF4081;
            cursor: pointer;
            position: absolute;
            top: 3px;
            right: 68px;
        }
        
        .container>.content>.option>.option-right>.md-checkbox[checked]:after {
            content: " ";
            border-left: 2px solid #fff;
            border-bottom: 2px solid #fff;
            height: 8px;
            width: 15px;
            box-sizing: border-box;
            position: absolute;
            transform: rotate(-45deg);
            top: 3px;
            left: 2px;
        }

        The rotation in css3 is used here to imitate a selection effect

        Note: Although p cannot be directly selected, you can still add a checkd attribute to it. This attribute It is a special css event effect that can be controlled through js.

        Finally, the login button.

        Here, absolute positioning must also be used, and the reference points are bottom and right

        .container>.login-button {
            position: absolute;
            height: 60px;
            width: 60px;
            border: 0px;
            outline: 0px;
            background-color: #FF4081;
            border-radius: 30px;
            right: -30px;
            bottom: 91px;
            box-shadow: 2px 0 0 rgba(0, 0, 0, 0.3) inset;
        }

        通過 box-shadow: 2px 0 0 rgba(0, 0, 0, 0.3) inset; 這句話可以知道一個(gè)內(nèi)嵌效果.

        中間的按鈕在不適用字體圖標(biāo)的情況下也必須要用p 旋轉(zhuǎn)來模仿了

        .container>.login-button >.icon-login {
            box-sizing: border-box;
            position: relative;
            width: 18px;
            height: 3px;
            background-color: #fff;
            transition: 0.3s;
            display: block;
            margin: auto;
        }
        
        .container>.login-button >.icon-login::after {
            content: &#39; &#39;;
            box-sizing: border-box;
            position: absolute;
            left: 8px;
            height: 12px;
            width: 12px;
            border-top: 3px solid #fff;
            border-right: 3px solid #fff;
            transform: rotate(45deg);
            top: -4px;
        }

        最后是鼠標(biāo)hover上的放大和陰影效果

        .container>.login-button:hover {
            box-shadow: 0 0 0 rgba(0, 0, 0, 0.3) inset, 0 3px 6px rgba(0, 0, 0, 0.16), 0 5px 11px rgba(0, 0, 0, 0.23)
        }
        
        .container>.login-button:hover>.icon-login {
            -ms-transform: scale(1.2);
            =webkit-transform: scale(1.2);
            transform: scale(1.2);
        }

        至此,所有的css已經(jīng)結(jié)束了,查看效果

        CSS3 制作一個(gè)material-design 風(fēng)格登錄界面實(shí)例

        transition bug修復(fù)

        當(dāng)我刷新頁面或者點(diǎn)擊忘記密碼的時(shí)候,input框就會(huì)抖動(dòng)一下,這個(gè)問題只會(huì)出現(xiàn)在chrome 瀏覽器上,firefox 或者edge都不會(huì)重現(xiàn),所以我才這應(yīng)該是兼容性的問題。 在不斷嘗試中,我發(fā)現(xiàn),只有取消 transition屬性,就不會(huì)產(chǎn)生抖動(dòng)。

        這個(gè)問題困擾了我3天,真實(shí)百思不得其姐。

        在某度中查詢半天,未果 。

        后來終于在 StackOverFlow 中,搜索chrome input transition 時(shí),終于一個(gè)回到讓我貌似頓開。

        this bug has been reported, adding an script tag somewhere can advoid it.

        之后,我在頁面尾部添加一個(gè)下面節(jié)點(diǎn),終于順利解決。

        <script src="./app.js type=" text/javascript "></script>

        在閱讀過一些文章之后,總結(jié)為

        當(dāng)chrome 的input 默認(rèn)屬性向自定義過度時(shí),因?yàn)榇嬖趖ransition,所以會(huì)產(chǎn)生抖動(dòng)。?而基本上所有的頁面都有script標(biāo)簽,所以這個(gè)bug 幾乎很難被重現(xiàn)。而我遇到,算是運(yùn)氣好吧。。

        至此,這個(gè)頁面全部內(nèi)容已經(jīng)完成。

        material-design 很贊,angular-material 是使用 AngularJS 封裝了 material-design 的UI 庫,很漂亮。不同于 bootstrap的完全扁平化風(fēng)格,它采用的是盒子堆砌效果,動(dòng)畫效果也比較贊。

        以上就是本文的全部內(nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持PHP中文網(wǎng)。

        更多CSS3 制作一個(gè)material-design 風(fēng)格登錄界面實(shí)例相關(guān)文章請(qǐng)關(guān)注PHP中文網(wǎng)!

        Statement of this Website
        The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

        Hot AI Tools

        Undress AI Tool

        Undress AI Tool

        Undress images for free

        Undresser.AI Undress

        Undresser.AI Undress

        AI-powered app for creating realistic nude photos

        AI Clothes Remover

        AI Clothes Remover

        Online AI tool for removing clothes from photos.

        Clothoff.io

        Clothoff.io

        AI clothes remover

        Video Face Swap

        Video Face Swap

        Swap faces in any video effortlessly with our completely free AI face swap tool!

        Hot Tools

        Notepad++7.3.1

        Notepad++7.3.1

        Easy-to-use and free code editor

        SublimeText3 Chinese version

        SublimeText3 Chinese version

        Chinese version, very easy to use

        Zend Studio 13.0.1

        Zend Studio 13.0.1

        Powerful PHP integrated development environment

        Dreamweaver CS6

        Dreamweaver CS6

        Visual web development tools

        SublimeText3 Mac version

        SublimeText3 Mac version

        God-level code editing software (SublimeText3)

        Hot Topics

        PHP Tutorial
        1502
        276
        CSS tutorial for creating loading spinners and animations CSS tutorial for creating loading spinners and animations Jul 07, 2025 am 12:07 AM

        There are three ways to create a CSS loading rotator: 1. Use the basic rotator of borders to achieve simple animation through HTML and CSS; 2. Use a custom rotator of multiple points to achieve the jump effect through different delay times; 3. Add a rotator in the button and switch classes through JavaScript to display the loading status. Each approach emphasizes the importance of design details such as color, size, accessibility and performance optimization to enhance the user experience.

        Addressing CSS Browser Compatibility issues and prefixes Addressing CSS Browser Compatibility issues and prefixes Jul 07, 2025 am 01:44 AM

        To deal with CSS browser compatibility and prefix issues, you need to understand the differences in browser support and use vendor prefixes reasonably. 1. Understand common problems such as Flexbox and Grid support, position:sticky invalid, and animation performance is different; 2. Check CanIuse confirmation feature support status; 3. Correctly use -webkit-, -moz-, -ms-, -o- and other manufacturer prefixes; 4. It is recommended to use Autoprefixer to automatically add prefixes; 5. Install PostCSS and configure browserslist to specify the target browser; 6. Automatically handle compatibility during construction; 7. Modernizr detection features can be used for old projects; 8. No need to pursue consistency of all browsers,

        What is the difference between display: inline, display: block, and display: inline-block? What is the difference between display: inline, display: block, and display: inline-block? Jul 11, 2025 am 03:25 AM

        Themaindifferencesbetweendisplay:inline,block,andinline-blockinHTML/CSSarelayoutbehavior,spaceusage,andstylingcontrol.1.Inlineelementsflowwithtext,don’tstartonnewlines,ignorewidth/height,andonlyapplyhorizontalpadding/margins—idealforinlinetextstyling

        Styling visited links differently with CSS Styling visited links differently with CSS Jul 11, 2025 am 03:26 AM

        Setting the style of links you have visited can improve the user experience, especially in content-intensive websites to help users navigate better. 1. Use CSS's: visited pseudo-class to define the style of the visited link, such as color changes; 2. Note that the browser only allows modification of some attributes due to privacy restrictions; 3. The color selection should be coordinated with the overall style to avoid abruptness; 4. The mobile terminal may not display this effect, and it is recommended to combine it with other visual prompts such as icon auxiliary logos.

        Creating custom shapes with css clip-path Creating custom shapes with css clip-path Jul 09, 2025 am 01:29 AM

        Use the clip-path attribute of CSS to crop elements into custom shapes, such as triangles, circular notches, polygons, etc., without relying on pictures or SVGs. Its advantages include: 1. Supports a variety of basic shapes such as circle, ellipse, polygon, etc.; 2. Responsive adjustment and adaptable to mobile terminals; 3. Easy to animation, and can be combined with hover or JavaScript to achieve dynamic effects; 4. It does not affect the layout flow, and only crops the display area. Common usages are such as circular clip-path:circle (50pxatcenter) and triangle clip-path:polygon (50%0%, 100 0%, 0 0%). Notice

        How to create responsive images using CSS? How to create responsive images using CSS? Jul 15, 2025 am 01:10 AM

        To create responsive images using CSS, it can be mainly achieved through the following methods: 1. Use max-width:100% and height:auto to allow the image to adapt to the container width while maintaining the proportion; 2. Use HTML's srcset and sizes attributes to intelligently load the image sources adapted to different screens; 3. Use object-fit and object-position to control image cropping and focus display. Together, these methods ensure that the images are presented clearly and beautifully on different devices.

        Demystifying CSS Units: px, em, rem, vw, vh comparisons Demystifying CSS Units: px, em, rem, vw, vh comparisons Jul 08, 2025 am 02:16 AM

        The choice of CSS units depends on design requirements and responsive requirements. 1.px is used for fixed size, suitable for precise control but lack of elasticity; 2.em is a relative unit, which is easily caused by the influence of the parent element, while rem is more stable based on the root element and is suitable for global scaling; 3.vw/vh is based on the viewport size, suitable for responsive design, but attention should be paid to the performance under extreme screens; 4. When choosing, it should be determined based on whether responsive adjustments, element hierarchy relationships and viewport dependence. Reasonable use can improve layout flexibility and maintenance.

        What are common CSS browser inconsistencies? What are common CSS browser inconsistencies? Jul 26, 2025 am 07:04 AM

        Different browsers have differences in CSS parsing, resulting in inconsistent display effects, mainly including the default style difference, box model calculation method, Flexbox and Grid layout support level, and inconsistent behavior of certain CSS attributes. 1. The default style processing is inconsistent. The solution is to use CSSReset or Normalize.css to unify the initial style; 2. The box model calculation method of the old version of IE is different. It is recommended to use box-sizing:border-box in a unified manner; 3. Flexbox and Grid perform differently in edge cases or in old versions. More tests and use Autoprefixer; 4. Some CSS attribute behaviors are inconsistent. CanIuse must be consulted and downgraded.

        See all articles