ホームページ  >  記事  >  ウェブフロントエンド  >  CSSを使用してログインフォームをレイアウトする方法

CSSを使用してログインフォームをレイアウトする方法

云罗郡主
云罗郡主オリジナル
2018-11-24 15:26:172076ブラウズ

この記事の内容は CSS を使用してログインフォームをレイアウトする方法についてです。必要な方は参考にしていただければ幸いです。

CSSを使用してログインフォームをレイアウトする方法

ログインフォームを作成するための Css レイアウト

このケースでは、主にログインフォームを生成します。この場合、ボックスが使用されます。シャドウ、グラデーション、トランスフォーム、トランジションなどの属性 最も難しいのは入力ボックスの噛んだ部分です。当初は複数の背景を持つ純粋な CSS3 グラデーションを使用して作成されましたが、シャドウのせいで最終的にベースを使用するように変更されました。 64ビットイメージを扱います。詳細なリファレンス コード:

HTML 構造:

<div class="box">
<form action="#" method="get">
<ul>
<li>
<label for="username">Email:</label><input type="text" id="username"  class="username" placeholder="john.smith@strategysoft.com"/>
</li>
<li>
<label for="password">Password:</label><input type="password" id="password" class="password" placeholder="******"/>
</li>
</ul>
<a href="javascript:;" class="button"/><i class="icon-arrow-right"></i></a>
</form>
</div>
CSS代码:
body,ul{
margin: 0;
padding: 0
}
a {
color: rgb(1, 124, 185);
text-decoration: none;
}
input:focus {
outline: none 0;
}
body{
color: #b5b5b5;
font: 14px &#39;Arial&#39;;
}
body,
li:first-child:after,
li:last-child:after{
background-image: url(data:image/png;base64,…);/**/
}
.box{
position: relative;
width: 384px;
height: 140px;
margin: 50px auto;
}
.box li{
list-style-type: none;
margin-bottom: 10px;
border-radius: 5px;
overflow: hidden;
position: relative;
height: 42px;
}
.box li input{
box-shadow:inset 0 0 5px rgba(0,0,0,.5),-1px 1px 0 rgba(255,255,255,.05);
border:0 none;
padding:8px 5px 5px;
border-radius: 5px;
width:300px;
height: 28px;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
-o-box-sizing: content-box;
-ms-box-sizing: content-box;
box-sizing: content-box;
background: rgba(0,0,0,.1);
color: #fff;
}
.box li:first-child:after,
.box li:last-child:after{
position: absolute;
width: 50px;
height: 50px;
content: "";
border-radius: 25px;
z-index: 2;
right: -23px;
box-shadow: 0 0 8px rgba(0,0,0,.5);
}
::-webkit-input-placeholder {
color:#fff;
font-weight: bold;
}
.box li:first-child:after{
top: 15px;
}
.box li:last-child:after{
bottom:15px;
}
.box label{
width: 70px;
display: inline-block;
text-align: right;
}
.box span{
display: block;
color: #6296b4;
padding-left: 75px;
}
.button{
position: absolute;
top: 24px;
right: -30px;
width: 44px;
height: 44px;
border-radius: 22px;
border:1px solid #00a1d2;
background: -webkit-linear-gradient(top,#029ecd,#0d7796);
color: #fff;
text-shadow:1px 1px 0 #666;
box-shadow:0 0 0 5px #2c2c2c;
z-index: 3;
text-align: center;
line-height: 46px;
-webkit-transition: all 0.28s ease-in;
-moz--transition: all 0.28s ease-in;
}
.button:hover{
-webkit-transform:rotate(90deg);
}
@font-face {
font-family: &#39;FontAwesome&#39;;
src: url(&#39;font/fontawesome-webfont.eot&#39;);
src: url(&#39;font/fontawesome-webfont.eot?#iefix&#39;) format(&#39;embedded-opentype&#39;),
url(&#39;font/fontawesome-webfont.woff&#39;) format(&#39;woff&#39;),
url(&#39;font/fontawesome-webfont.ttf&#39;) format(&#39;truetype&#39;),
url(&#39;font/fontawesome-webfont.svg#FontAwesome&#39;) format(&#39;svg&#39;);
font-weight: normal;
font-style: normal;
}
.icon-arrow-right:before {
font-family: FontAwesome;
font-weight: normal;
font-size: 26px;
font-style: normal;
display: inline-block;
text-decoration: inherit;
content: "\f061";
}

上記は、CSS を使用してログイン フォームをレイアウトする方法の完全な紹介です。CSS チュートリアル# について詳しく知りたい場合は、 # #、PHP 中国語 Web サイトにご注意ください。


以上がCSSを使用してログインフォームをレイアウトする方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。