我们怎样才能用css& HTML? [英] how can we make forms like this with css & html?

查看:147
本文介绍了我们怎样才能用css& HTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



一个问题:
$ b $

感谢您查看

Adam Ramadhan

感谢@corroded对你的评论(没有更多的DIV被发现!)
在FF 4b10上测试,看起来相当不错。下面的代码是我在这里多次迭代后得到的。
我相信它可以得到改进(例如,更好地重用css类),但是对于答案3.0在远处的将来有一段时间;)

<原始代码在这里: http://jsfiddle.net/vSqR3/19/

p>

并测试新的: http:// jsfiddle。 net / vSqR3 / 62 /

 < html> 
< head>
< style type =text / css>
.noBullets {
list-style-type:none;
}
.containerDiv {
margin-left:0px;
border-width:1px;
border-color:#333;
border-top-style:none;
border-right-style:none;
border-left-style:none;
border-bottom-style:solid;
width:284px;
height:20px;
}
.containerDivNoBorder {
margin-left:0px;
border-top-style:none;
border-right-style:none;
border-left-style:none;
border-bottom-style:none;
width:284px;
height:20px;
}
.floatingLabel {
width:160px;
height:20px;
float:left;
border-style:none;
}
.floatingShort {
border-width:1px;
border-color:#333;
border-top-style:none;
border-right-style:none;
border-left-style:solid;
border-bottom-style:none;
width:39px;
height:20px;
float:left;
}
。浮动中值{
border-top-style:none;
border-width:1px;
border-color:#333;
border-right-style:none;
border-left-style:solid;
border-bottom-style:none;
width:80px;
height:20px;
float:left;
}
.floatingLong {
border-top-style:none;
border-width:1px;
border-color:#333;
border-right-style:none;
border-left-style:solid;
border-bottom-style:none;
width:120px;
height:20px;
float:left;
}
.floatingLongBorder {
border-top-style:none;
border-right-style:none;
border-left-style:solid;
border-width:1px;
border-color:#333;
border-bottom-style:solid;
width:120px;
height:20px;
float:left;
}
< / style>
< / head>
< body>
< form id =formname =formmethod =postaction =send.html>
< ul class =noBullets>
< h3> USER ACCOUNT< / h3>
< li class =containerDiv>
< label class =floatingLabel> NAME< / label>
< input class =floatingLongtype =textname ='name'/>
< / li>
< li class =containerDiv>
< label class = floatLabel> SURNAME< / label>
< input class = floatLong type =textname ='surname'/>
< / li>
< li class =containerDiv>
< label class =floatingLabel> BIRTHDAY< / label>
< input class =floatingShorttype =textname ='bd_d'/>
< input class =floatingShorttype =textname ='bd_m'/>
< input class =floatingShorttype =textname ='bd_y'/>
< / li>
< li class =containerDiv>
< label class =floatingLabel> GENDER< / label>
< input class =floatingShorttype =textname ='gender1'/>
< input class =floatingMediumtype =textname ='gender2'/>
< / li>
< li class =containerDiv>
< label class =floatingLabel> USERNAME< / label>
< input class =floatingLongtype =textname ='username'/>
< / li>
< li class =containerDivNoBorder>
< label class =floatingLabel>电子邮件< / label>
< input class =floatingLongBordertype =textname ='email1'/>
< / li>
< li class =containerDiv>
< label class =floatingLabel> RE-TYPE电子邮件< / label>
< input class =floatingLongtype =textname ='email2'/>
< / li>
< li class =containerDivNoBorder>
< label class =floatingLabel> PASSWORD< / label>
< input class =floatingLongBordertype =passwordname ='password1'/>
< / li>
< li class =containerDiv>
< label class =floatingLabel> RE-TYPE PASSWORD< / label>
< input class =floatingLongtype =passwordname ='password2'/>
< / li>
< input type =submitvalue =Submit/>
< / ul>
< / form>
< / body>
< / html>


now thats a problem :|

Thanks for looking in

Adam Ramadhan

解决方案

Well, I used it to learn about forms and CSS :) Thanks @corroded for your comment (there are no more DIVs to be found!) Tested on FF 4b10, it looks pretty darn close. The code below is what I got after several iterations here. I'm sure it can be improved (i.e., better reuse of the css classes) but tht's for the answer 3.0 some time in the far away future ;)

The original code is here: http://jsfiddle.net/vSqR3/19/

and to test the new one: http://jsfiddle.net/vSqR3/62/

<html>
    <head>
        <style type="text/css">
        .noBullets {
            list-style-type: none;
        }
        .containerDiv {
            margin-left:0px;
            border-width:1px;
            border-color:#333;
            border-top-style:none;
            border-right-style:none;
            border-left-style:none;
            border-bottom-style:solid;
            width: 284px;
            height:20px;
        }
        .containerDivNoBorder {
            margin-left:0px;
            border-top-style:none;
            border-right-style:none;
            border-left-style:none;
            border-bottom-style:none;
            width: 284px;
            height:20px;
        }
        .floatingLabel {
            width: 160px;
            height:20px;
            float:left;
            border-style:none;
        }
        .floatingShort {
            border-width:1px;
            border-color:#333;
            border-top-style:none;
            border-right-style:none;
            border-left-style:solid;
            border-bottom-style:none;
            width: 39px;
            height:20px;
            float:left;
        }
        .floatingMedium {
            border-top-style:none;
            border-width:1px;
            border-color:#333;
            border-right-style:none;
            border-left-style:solid;
            border-bottom-style:none;
            width: 80px;
            height:20px;
            float:left;
        }
        .floatingLong {
            border-top-style:none;
            border-width:1px;
            border-color:#333;
            border-right-style:none;
            border-left-style:solid;
            border-bottom-style:none;
            width: 120px;
            height:20px;
            float:left;
         }
        .floatingLongBorder {
            border-top-style:none;
            border-right-style:none;
            border-left-style:solid;
            border-width:1px;
            border-color:#333;
            border-bottom-style:solid;
            width: 120px;
            height:20px;
            float:left;
        }
        </style>
    </head>
    <body>
        <form id="form" name="form" method="post" action="send.html">
            <ul class="noBullets">
             <h3>USER ACCOUNT</h3>
               <li class="containerDiv">
                    <label class="floatingLabel">NAME</label>
                    <input class="floatingLong" type="text" name='name'/>
                </li>
                <li class="containerDiv">
                    <label class=floatingLabel>SURNAME</label>
                    <input class=floatingLong type="text" name='surname'/>
                </li>
                <li class="containerDiv">
                    <label class="floatingLabel">BIRTHDAY</label>
                    <input class="floatingShort" type="text" name='bd_d'/>
                    <input class="floatingShort" type="text" name='bd_m'/>
                    <input class="floatingShort" type="text" name='bd_y'/>
                </li>
                <li class="containerDiv">
                    <label class="floatingLabel">GENDER</label>
                    <input class="floatingShort" type="text" name='gender1'/>
                    <input class="floatingMedium" type="text" name='gender2'/>
                </li>
                <li class="containerDiv">
                    <label class="floatingLabel">USERNAME</label>
                    <input class="floatingLong" type="text" name='username'/>
                </li>
                <li class="containerDivNoBorder">
                    <label class="floatingLabel">E-MAIL</label>
                    <input class="floatingLongBorder" type="text" name='email1'/>
                </li>
                <li class="containerDiv">
                    <label class="floatingLabel">RE-TYPE E-MAIL</label>
                    <input class="floatingLong" type="text" name='email2'/>
                </li>
                <li class="containerDivNoBorder">
                    <label class="floatingLabel">PASSWORD</label>
                    <input class="floatingLongBorder" type="password" name='password1'/>
                </li>
                <li class="containerDiv">
                    <label class="floatingLabel">RE-TYPE PASSWORD</label>
                    <input class="floatingLong" type="password" name='password2'/>
                </li>
                <input type="submit" value="Submit" />
            </ul>
        </form>
    </body>
</html>

这篇关于我们怎样才能用css&amp; HTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆