Sample code sharing about text box style in css

黄舟
Release: 2017-07-26 14:13:20
Original
3095 people have browsed it

1. Text box with only underline:

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

2. Software serial number input box:

<script for="T" event="onkeyup">
if(value.length==3)document.all[event.srcElement.sourceIndex+1].select();
</script>
<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">
Copy after login

3. Software serial number input box (full version):

<script for="T" event="onkeyup">if(value.length==maxLength)document.all[event.srcElement.sourceIndex+1].focus();</script>
<script for="T" event="onfocus">select();</script>
<script for="Submit" event="onclick">
var sn=new Array();
for(i=0;i<T.length;i++)
sn=T.value;
alert(sn.join("—"));
</script>
<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">
<input type="submit" name="Submit">
Copy after login

4. The background of the input box is transparent:

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

5. When the mouse moves over the input box, the background color of the input box changes color:

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

6. The border of the input box when inputting words Flashing (the border is a small square):

<Script Language="JavaScript">
function borderColor(){
if(self[&#39;oText&#39;].style.borderColor==&#39;red&#39;){
self[&#39;oText&#39;].style.borderColor = &#39;yellow&#39;;
}else{
self[&#39;oText&#39;].style.borderColor = &#39;red&#39;;
}
oTime = setTimeout(&#39;borderColor()&#39;,400);
}
</Script>
<input type="text" id="oText" style="border:5px dotted red;color:red" onfocus="borderColor(this);" onblur="clearTimeout(oTime);">
Copy after login

7. When inputting words, the input box border flashes (the border is a dotted line):

<style>
#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)})};
</style>
<input type="text" id="oText">
Copy after login

8. The input box automatically stretches horizontally:

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

9. Text box that automatically extends downward:

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

1. Button style

.buttoncss {     
font-family: "tahoma", "宋体"; 
/*www.52css.com*/     
font-size:9pt; color: #003399;     
border: 1px #003399 solid;     
color:#006699;     
border-bottom: #93bee2 1px solid;     
border-left: #93bee2 1px solid;     
border-right: #93bee2 1px solid;     
border-top: #93bee2 1px solid;     
background-image:url(../images/bluebuttonbg.gif);    
 background-color: #e8f4ff;     
 cursor: hand;     
 font-style: normal ;     
 width:60px;     
 height:22px;
 }
Copy after login

2. Blue button

.bluebuttoncss {     
font-family: "tahoma", "宋体"; 
/*www.52css.com*/     
font-size: 9pt; color: #003366;     
border: 0px #93bee2 solid;     
border-bottom: #93bee2 1px solid;     
border-left: #93bee2 1px solid;     
border-right: #93bee2 1px solid;     
border-top: #93bee2 1px solid;*/     
background-image:url(../images/blue_button_bg.gif);     
background-color: #ffffff;     
cursor: hand;    
 font-style: normal ;
 }
Copy after login

3. Red button

.redbuttoncss {     
font-family: "tahoma", "宋体"; 
/*www.52css.com*/     
font-size: 9pt; color: #0066cc;     
border: 1px #93bee2 solid;     
border-bottom: #93bee2 1px solid;     
border-left: #93bee2 1px solid;     
border-right: #93bee2 1px solid;     
border-top: #93bee2 1px solid;     
background-image:url(../images/redbuttonbg.gif);     
background-color: #ffffff;     
cursor: hand;     
font-style: normal ;
}
Copy after login

4. Select button

.selectbuttoncss{     
font-family: "tahoma", "宋体"; 
/*www.52css.com*/     
font-size: 9pt; color: #0066cc;     
border: 1px #93bee2 solid;     
border-bottom: #93bee2 1px solid;     
border-left: #93bee2 1px solid;     
border-right: #93bee2 1px solid;     
border-top: #93bee2 1px solid;     
background-image:url(../images/blue_button_bg.gif);     
background-color: #ffffff;     
cursor: hand;     
font-style: normal ;}
Copy after login

5. Green button

.greenbuttoncss {     
font-family: "tahoma", "宋体"; 
/*www.52css.com*/     
font-size: 9pt; color: #0066cc;     
border: 1px #93bee2 solid;     
border-bottom: #93bee2 1px solid;     
border-left: #93bee2 1px solid;     
border-right: #93bee2 1px solid;     
border-top: #93bee2 1px solid;     
background-image:url(../images/greenbuttonbg.gif);     
background-color: #ffffff;     
cursor: hand;     
font-style: normal ;
}
Copy after login

6. Image button

.imagebutton{     
cursor: hand;     
/*改变鼠标形状  
}
Copy after login

7. Page text

body {     
scrollbar-face-color: #ededf3;     
scrollbar-highlight-color: #ffffff;     
scrollbar-shadow-color: #93949f;     
scrollbar-3dlight-color: #ededf3;     
scrollbar-arrow-color: #082468;     
scrollbar-track-color: #f7f7f9;     
scrollbar-darkshadow-color: #ededf3;     
font-size: 9pt; 
/*www.52css.com*/     
color: #003366;    
 overflow:auto;} 
 td { font-size: 12px }th {     
 font-size: 12px;}
Copy after login

8. Drop-down selection box

select{     
border-right: #000000 1px solid;     
border-top: #ffffff 1px solid;     
font-size: 12px; 
/*www.52css.com*/     
border-left: #ffffff 1px solid;     
color:#003366;     
border-bottom: #000000 1px solid;     
background-color: #f4f4f4;}
Copy after login

9. Line text editing box

.editbox{     
background: #ffffff;     
border: 1px solid #b7b7b7;     
color: #003366;     
cursor: text;     
font-family: "arial";     
font-size: 9pt;     
height: 18px;     
padding: 1px; 
/* 
}
Copy after login

10. Multi-line text box

.multieditbox{     
background: #f8f8f8;     
border-bottom: #b7b7b7 1px solid;     
border-left: #b7b7b7 1px solid;     
border-right: #b7b7b7 1px solid;     
border-top: #b7b7b7 1px solid;     
color: #000000;     
cursor: text;     
font-family: "arial";     
font-size: 9pt;     
padding: 1px; 
/* 
}
Copy after login

11. Shadow style form

.shadow {     
position:absolute;     
z-index:1000;     
top:0px;     
left:0px; 
/*www.52css.com*/     
background:gray;     
background-color:#ffcc00;     
filter : progidximagetransform.microsoft.dropshadow(color=#ff404040,offx=2,offy=2,positives=true);}
Copy after login

12. Input box with only one horizontal line displayed

.logintxt{     
border-right: #ffffff 0px solid;     
border-top: #ffffff 0px solid;     
font-size: 9pt; 
/*www.52css.com*/     
border-left: #ffffff 0px solid;    
 border-bottom: #c0c0c0 1px solid;     
 background-color: #ffffff}
Copy after login

13. Input box with no border

.noneinput{     
text-align:center;     
width:99%;height:99%;     
border-top-style: none;     
border-right-style: none;     
border-left-style: none;     
background-color: #f6f6f6;     
border-bottom-style: none;
}
Copy after login


The above is the detailed content of Sample code sharing about text box style in css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template