时间:2019-08-08
编辑:网站制作公司
5535
0
用户友好的界面和简洁性是设计有效的Web订单时的关键点。与单页表单(注册表单或联系表单)不同,订单表单往往需要填写几页或步骤(包括付款方式)。将所有这些显示在一个页面中并不是一个好主意。如果表单似乎永无止境,用户可能会感到沮丧。郑州企业网站建设
保持字段列表更短更整洁的好方法,但仍然能够收集所需的所有数据是将它们分解为步骤。但是,最好让用户事先了解他们必须完成多少步骤才能完成整个订单流程。
现在这里有一个教程,可以帮助您制作简单而现代的Web订单表单。
您需要的所有图形只是一个CSS Sprite图像,它将用作步骤菜单的背景。
有些人可能会发现为菜单创建单独的图像很容易。但是,最好将其合并为一个图像,以减少对菜单的HTTP请求。
在组合菜单背景图像之前,您需要知道单个菜单背景的宽度和高度。在这种情况下,每个图像的大小是W170px x H100px。并且您需要4个步骤的8个背景图像(4个活动,4个不活动),因此总高度将是800px。宽度保持在170px。
准备好单个图像后,可以使用CSS中的background-position属性来显示单个图像的可见部分,如下所示。
1 2 3 4 五 6 7 8 9 10 11 12 13 14 15 | .bg-step1-orange {background:url(../img/img-orange.jpg) no-repeat; height:100px; background-position:0 0px;} .bg-step2-orange {background:url(../img/img-orange.jpg) no-repeat; height:100px; background-position:0 -100px;} .bg-step3-orange {background:url(../img/img-orange.jpg) no-repeat; height:100px; background-position:0 -200px;} .bg-step4-orange {background:url(../img/img-orange.jpg) no-repeat; height:100px; background-position:0 -300px;} .bg-step1-o-orange {background:url(../img/img-orange.jpg) no-repeat; height:100px; background-position:0 -400px;} .bg-step2-o-orange {background:url(../img/img-orange.jpg) no-repeat; height:100px; background-position:0 -500px;} .bg-step3-o-orange {background:url(../img/img-orange.jpg) no-repeat; height:100px; background-position:0 -600px;} .bg-step4-o-orange {background:url(../img/img-orange.jpg) no-repeat; height:100px; background-position:0 -700px;} |
现在使用CSS为菜单设置排版样式。
1 2 3 4 五 6 7 8 9 10 | .typo-step {color:#382201; font:bold 30px Rockwell;} /* This is for the selected "STEP".*/ .typo-step-o {color:#fff; font:bold 30px Rockwell;} /* This is for the white "STEP".*/ .typo-right {padding:60px 0px 0px 30px;} .typo-w {color:#fff;} /* This is for the white text. */ |
您可以使用相同的技术制作多种颜色。
HTML标记如下所示。
1 2 3 4 五 6 7 8 9 10 11 12 13 14 15 | <div class="box-170 bg-step1-orange" > <p class="typo-right"><span class="typo-step">STEP</span><br />Your info</p> </div> <div class="box-170 ml-3 bg-step2-o-orange" > <p class=" typo-right"><span class="typo-step-o">STEP</span><br /><span class="typo-w">Payment</span></p> </div> <div class="box-170 ml-3 bg-step3-o-orange" > <p class="typo-right"><span class="typo-step-o">STEP</span><br /><span class="typo-w">Submit order</span></p> </div> <div class="box-170 ml-3 bg-step4-o-orange" > <p class="typo-right"><span class="typo-step-o">STEP</span><br /><span class="typo-w">Confirmation</span></p> </div> |
下面显示的是用于设置Web表单样式的CSS。
1 2 3 4 五 6 7 | form.order {padding:40px;} ul.order li {line-height:2.4em; border-bottom:1px dashed #fff; clear:both; padding:0px 20px;} form.order label {float:left; width:200px;} form.order input.text {width:280px; background:#fff; border:1px solid #eee;} form.order input.text1 {width:180px; background:#fff; border:1px solid #eee;} form.order select.drop {width:280px; background:#fff; border:1px solid #eee;} form.order select.drop1 {width:80px; background:#fff; border:1px solid #eee;} |
这是HTML标记。
1 2 3 4 五 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 三十 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | <form id="" name="" method="" action="orange-form-2.html" class="order"> <fieldset> <ul class="order"> <li> <label for="name">Title:<span class="typo-1">*</span></label> <select class="drop1" id="" name="" > <option value="">Mr.</option> <option value="">Mrs.</option> <option value="">Ms.</option> <option value="">Dr.</option> </select> </li> <li> <label for="firstName">First name (middle)<span class="typo-1">*</span></label> <input class="text" type="text" id="" name="" value="" size="30" maxlength="20"> </li> <li><label for="lastName">Last name<span class="typo-1">*</span></label> <input class="text" type="text" id="" name="" value="" size="30" maxlength="20"> </li> <li><label for="email">E-mail address<span class="typo-1">*</span></label> <input class="text" type="text" id="email" name="" value="" size="30" maxlength="50"> </li> <li><label for="">Phone<span class="typo-1">*</span></label> <input class="text" type="text" id="tel" name="" value="" size="16" maxlength="10"> </li> </ul> <div class="clear"></div> <ul class="order"> <li><label for="country">Country<span class="typo-1">*</span></label> <select class="drop" id="country" name="country" ></select> </li> <li><label id="lblStreet" for="street">Street<span class="typo-1">*</span></label> <input class="text" type="text" id="street" name="street" value="" size="30" maxlength="100" > </li> <li><label id="lblCity" for="city">City<span class="typo-1">*</span></label> <input class="text" type="text" id="city" name="city" value="" size="30" maxlength="50" > </li> <li><label id="lblState" for="state">State<span class="typo-1">*</span></label> <select class="drop1" id="state" name="state" ></select> </li> <li><label id="lblZip" for="zip">Zip:<span class="typo-1">*</span></label><br /> <input class="text1" type="text" id="zip" name="zip" value="" size="25" maxlength="25"> </li> </ul> <div class="clear"></div> <input class="bt-order-orange" type="submit" value="Next step" onclick="" /> <div class="clear"></div> </fieldset> </form> |
下面是CSS样式。
1 2 | .box-200 {width:200px; display:inline; float:left;} .box-300 {width:300px; display:inline; float:left;} |
您可以使用与上面相同的类。
1 | ul.order li {line-height:2.4em; border-bottom:1px dashed #fff; clear:both; padding:0px 20px;} |
这是HTML标记。
1 2 3 4 五 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <div class="box-200 pl-9 pb-6"> <ul class="order"> <li>Title</li> <li>First Name & MI</li> <li>Last Name</li> <li>Email Address</li> <li>Phone (Home)</li> <li>Phone (Daytime)</li> <li>Home Address</li> </ul> <div class="clear"></div> </div> <div class="box-300 pl-9 pb-6"> <ul class="order"> <li>Ms.</li> <li>XXXX</li> <li>XXXX</li> <li>xxx@xxx.com</li> <li>111-111-111</li> <li>111-111-111</li> <li>100 Avenue New York, NY 10001</li> </ul> <div class="clear"></div> </div> |
通过使用上面显示的这种方法,您还可以将它们分成几个步骤,将其应用于具有长字段列表的其他类型的表单。这使用户友好。使用本教程,您可以将您的创造力提升到新的水平。
郑州企业网站建设
3
s后返回登录3
s后返回登录