当前位置:Gxlcms > css > css中关于文本框样式的示例代码分享

css中关于文本框样式的示例代码分享

时间:2021-07-01 10:21:17 帮助过:84人阅读

1、只有下划线的文本框:

  1. <input style="border:0;border-bottom:1 solid black;background:;">

2、软件序列号式的输入框:

  1. <script for="T" event="onkeyup">
  2. if(value.length==3)document.all[event.srcElement.sourceIndex+1].select();
  3. </script>
  4. <input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T7" size="5" maxlength="3">

3、软件序列号式的输入框(完整版):

  1. <script for="T" event="onkeyup">if(value.length==maxLength)document.all[event.srcElement.sourceIndex+1].focus();</script>
  2. <script for="T" event="onfocus">select();</script>
  3. <script for="Submit" event="onclick">
  4. var sn=new Array();
  5. for(i=0;i<T.length;i++)
  6. sn=T.value;
  7. alert(sn.join("—"));
  8. </script>
  9. <input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">—<input name="T" size="5" maxlength="3">
  10. <input type="submit" name="Submit">

4、输入框景背景透明:

  1. <input style="background:transparent;border:1px solid #ffffff">

5、鼠标划过输入框,输入框背景色变色:

  1. <INPUT value="Type here" NAME="user_pass" TYPE="text" SIZE="29" onmouseover="this.style.borderColor='black';this.style.backgroundColor='plum'"
  2. style="width: 106; height: 21"
  3. onmouseout="this.style.borderColor='black';this.style.backgroundColor='#ffffff'" style="border-width:1px;border-color=black">

6、输入字时输入框边框闪烁(边框为小方型):

  1. <Script Language="JavaScript">
  2. function borderColor(){
  3. if(self['oText'].style.borderColor=='red'){
  4. self['oText'].style.borderColor = 'yellow';
  5. }else{
  6. self['oText'].style.borderColor = 'red';
  7. }
  8. oTime = setTimeout('borderColor()',400);
  9. }
  10. </Script>
  11. <input type="text" id="oText" style="border:5px dotted red;color:red" onfocus="borderColor(this);" onblur="clearTimeout(oTime);">

7、输入字时输入框边框闪烁(边框为虚线):

  1. <style>
  2. #oText{border:1px dotted #ff0000;ryo:expression(onfocus=function light (){with(document.all.oText){style.borderColor=(style.borderColor=="#ffee00"?"#ff0000":"#ffee00");timer=setTimeout(light,500);}},onblur=function(){this.style.borderColor="#ff0000";clearTimeout(timer)})};
  3. </style>
  4. <input type="text" id="oText">

8、自动横向廷伸的输入框:

  1. <input type="text" style="huerreson:expression(this.width=this.scrollWidth)" value="abcdefghijk">

9、自动向下廷伸的文本框:

  1. <textarea name="content" rows="6" cols="80" onpropertychange="if(this.scrollHeight>80) this.style.posHeight=this.scrollHeight+5">输入几个回车试试</textarea>

一、按钮样式

  1. .buttoncss {
  2. font-family: "tahoma", "宋体";
  3. /*www.52css.com*/
  4. font-size:9pt; color: #003399;
  5. border: 1px #003399 solid;
  6. color:#006699;
  7. border-bottom: #93bee2 1px solid;
  8. border-left: #93bee2 1px solid;
  9. border-right: #93bee2 1px solid;
  10. border-top: #93bee2 1px solid;
  11. background-image:url(../images/bluebuttonbg.gif);
  12. background-color: #e8f4ff;
  13. cursor: hand;
  14. font-style: normal ;
  15. width:60px;
  16. height:22px;
  17. }

二、蓝色按钮

  1. .bluebuttoncss {
  2. font-family: "tahoma", "宋体";
  3. /*www.52css.com*/
  4. font-size: 9pt; color: #003366;
  5. border: 0px #93bee2 solid;
  6. border-bottom: #93bee2 1px solid;
  7. border-left: #93bee2 1px solid;
  8. border-right: #93bee2 1px solid;
  9. border-top: #93bee2 1px solid;*/
  10. background-image:url(../images/blue_button_bg.gif);
  11. background-color: #ffffff;
  12. cursor: hand;
  13. font-style: normal ;
  14. }

三、红色按钮

  1. .redbuttoncss {
  2. font-family: "tahoma", "宋体";
  3. /*www.52css.com*/
  4. font-size: 9pt; color: #0066cc;
  5. border: 1px #93bee2 solid;
  6. border-bottom: #93bee2 1px solid;
  7. border-left: #93bee2 1px solid;
  8. border-right: #93bee2 1px solid;
  9. border-top: #93bee2 1px solid;
  10. background-image:url(../images/redbuttonbg.gif);
  11. background-color: #ffffff;
  12. cursor: hand;
  13. font-style: normal ;
  14. }

四、选择按钮

  1. .selectbuttoncss{
  2. font-family: "tahoma", "宋体";
  3. /*www.52css.com*/
  4. font-size: 9pt; color: #0066cc;
  5. border: 1px #93bee2 solid;
  6. border-bottom: #93bee2 1px solid;
  7. border-left: #93bee2 1px solid;
  8. border-right: #93bee2 1px solid;
  9. border-top: #93bee2 1px solid;
  10. background-image:url(../images/blue_button_bg.gif);
  11. background-color: #ffffff;
  12. cursor: hand;
  13. font-style: normal ;}

五、绿色按钮

  1. .greenbuttoncss {
  2. font-family: "tahoma", "宋体";
  3. /*www.52css.com*/
  4. font-size: 9pt; color: #0066cc;
  5. border: 1px #93bee2 solid;
  6. border-bottom: #93bee2 1px solid;
  7. border-left: #93bee2 1px solid;
  8. border-right: #93bee2 1px solid;
  9. border-top: #93bee2 1px solid;
  10. background-image:url(../images/greenbuttonbg.gif);
  11. background-color: #ffffff;
  12. cursor: hand;
  13. font-style: normal ;
  14. }

六、图像按钮

  1. .imagebutton{
  2. cursor: hand;
  3. /*改变鼠标形状
  4. }

七、页面正文

  1. body {
  2. scrollbar-face-color: #ededf3;
  3. scrollbar-highlight-color: #ffffff;
  4. scrollbar-shadow-color: #93949f;
  5. scrollbar-3dlight-color: #ededf3;
  6. scrollbar-arrow-color: #082468;
  7. scrollbar-track-color: #f7f7f9;
  8. scrollbar-darkshadow-color: #ededf3;
  9. font-size: 9pt;
  10. /*www.52css.com*/
  11. color: #003366;
  12. overflow:auto;}
  13. td { font-size: 12px }th {
  14. font-size: 12px;}

八、下拉选择框

  1. select{
  2. border-right: #000000 1px solid;
  3. border-top: #ffffff 1px solid;
  4. font-size: 12px;
  5. /*www.52css.com*/
  6. border-left: #ffffff 1px solid;
  7. color:#003366;
  8. border-bottom: #000000 1px solid;
  9. background-color: #f4f4f4;}

九、线条文本编辑框

  1. .editbox{
  2. background: #ffffff;
  3. border: 1px solid #b7b7b7;
  4. color: #003366;
  5. cursor: text;
  6. font-family: "arial";
  7. font-size: 9pt;
  8. height: 18px;
  9. padding: 1px;
  10. /*
  11. }

十、多行文本框

  1. .multieditbox{
  2. background: #f8f8f8;
  3. border-bottom: #b7b7b7 1px solid;
  4. border-left: #b7b7b7 1px solid;
  5. border-right: #b7b7b7 1px solid;
  6. border-top: #b7b7b7 1px solid;
  7. color: #000000;
  8. cursor: text;
  9. font-family: "arial";
  10. font-size: 9pt;
  11. padding: 1px;
  12. /*
  13. }

十一、阴影风格的表单

  1. .shadow {
  2. position:absolute;
  3. z-index:1000;
  4. top:0px;
  5. left:0px;
  6. /*www.52css.com*/
  7. background:gray;
  8. background-color:#ffcc00;
  9. filter : progidximagetransform.microsoft.dropshadow(color=#ff404040,offx=2,offy=2,positives=true);}

十二、只显一条横线的输入框

  1. .logintxt{
  2. border-right: #ffffff 0px solid;
  3. border-top: #ffffff 0px solid;
  4. font-size: 9pt;
  5. /*www.52css.com*/
  6. border-left: #ffffff 0px solid;
  7. border-bottom: #c0c0c0 1px solid;
  8. background-color: #ffffff}

十三、没有边框的输入框

  1. .noneinput{
  2. text-align:center;
  3. width:99%;height:99%;
  4. border-top-style: none;
  5. border-right-style: none;
  6. border-left-style: none;
  7. background-color: #f6f6f6;
  8. border-bottom-style: none;
  9. }

以上就是css中关于文本框样式的示例代码分享的详细内容,更多请关注Gxl网其它相关文章!

人气教程排行