关闭

文本框添加背景图的各种问题

196人阅读 评论(0) 收藏 举报

1. IE浏览器
2. 文本输入框,且设置了背景图片
3. 文本框文字超过其宽度
4. 光标位于超过文本框宽度的文字后

5.input背景图随着文本超出而左移,如何固定背景? 

 

6.

.sc_sou_zb{ width:121px; height:24px; line-height:24px; background:url(shangc/sc_13.jpg) no-repeat; border:none; padding-left:10px;}

 

<input name="imageField" type="submit" value="" class="sc_sou_zb" style="cursor:hand" />

 

改动鼠标箭头的样式

cursor:hand

 

7

 

参考网页:

http://www.itref.cn/a/css/2010/0623/62.html

 

http://hi.baidu.com/iadong/blog/item/60067a61062e2cd78db10da3.html

 

http://growinghome.webicn.com

 

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<style type="text/css">
<!--
/*body {
 background-image: url(image/bg.jpg);
 }
 .us_Submit_text {
 border:medium none;
 cursor:pointer;
 height:30px;
 width:132px;
 background-attachment: scroll;
 background-color: transparent;
 background-image: url(image/cxbg.jpg);
 background-repeat: repeat;
 background-position: 0 0;
}

.us_Submit_tj {
 border:medium none;
 cursor:pointer;
 height:30px;
 width:101px;
 background-attachment: scroll;
 background-color: transparent;
 background-image: url(image/ssan.jpg);
 background-repeat: repeat;
 background-position: 0 0;
}*/
-->
</style>
<style type="text/css">

.ner{font:normal 12px/22px "宋体"; color:#000000;}
ul,li{
margin:0px;
padding:0px;
}
li{
padding:0 1px;
font:normal 12px/22px "宋体"; color:#FFFFFF;
display:inline;
line-height:22px;
width:78px;
list-style:none;
list-style-position:outside;
text-align:center;
font-weight:bold;
float:left;
}
a{
 color:#FFFFFF;
 text-decoration:none;
 float:none;
 width:110px;
 height: 25px;
 font-weight: normal;
 padding: 0px;
 text-align:center;
}

a:hover{
 color:#CCFFCC;
 float:none;
 width:110px;
 text-decoration:none;
 padding: 0px;
 height: 25px;
 background-color: #009900;
}
.fo {
 font-size: 12px;
 line-height: 20px;
 color: #FFFFFF;
}

#nav{
 width:800px;
 height:30px;
 border-bottom:0px;
 padding:0px 5px;
 position:absolute;
 z-index:1;
 top: 85px;
 visibility: visible;
}
.list{
line-height:25px;
width:110px;
text-align:center;
padding:0px;
font-weight:normal;
}
.menu1{
 width:110px;
 height:auto;
 color:#FFFFFF;
 cursor:hand;
 overflow-y:hidden;
 margin: 0px;
 padding: 0px;
 font-weight: normal;
 line-height:25px;
 border-top-width: 0px;
 border-right-width: 1px;
 border-bottom-width: 0px;
 border-left-width: 0px;
 border-top-style: dashed;
 border-right-style: dashed;
 border-bottom-style: dashed;
 border-left-style: dashed;
 border-top-color: #666666;
 border-right-color: #FFFFFF;
 border-bottom-color: #666666;
 border-left-color: #666666;
 background-image: url(image/nh.jpg);
}
</style>
<!--
body {
 background-image: url(image/bg.jpg);
}
-->
</style>
<link href="css.css" rel="stylesheet" type="text/css" />
<script type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<style type="text/css">
<!--
.fo41 {font-size: 12px;
 color: #009900;
 text-decoration: none;
}
.list {line-height:25px;
width:110px;
text-align:center;
padding:0px;
font-weight:normal;
}
.menu2 {
 width:110px;
 height:25px;
 line-height:25px;
 color:#FFFFFF;
 overflow-y:hidden;
 cursor:hand;
 margin: 0px;
 padding: 0px;
 font-weight: normal;
 background-repeat: repeat;
 border-right-width: 1px;
 border-right-style: dashed;
 border-right-color: #FFFFFF;
 border-left-width: 1px;
 border-left-style: none;
 border-left-color: #FFFFFF;
}
#nav {
 width:970px;
 height:30px;
 border-bottom:0px;
 padding:0px 5px;
 position:absolute;
 z-index:1;
 top: 215px;
 visibility: visible;
 left: 38px;
}
body {
 background-image: url(image/bg.jpg);
}

.us_Submit_text {
 border:medium none;
 cursor:pointer;
 height:36px;
 width:132px;
 background-attachment: scroll;
 background-color: transparent;
 background-image: url(image/cxbg.jpg);
 background-repeat: repeat;
 background-position: 0 0;
 text-align:center;
 
 
}
.us_Submit_text1 {
 border:medium none;
 cursor:pointer;
 /*height:36px;*/
 width:132px;
 background-attachment: scroll;
 background-color: transparent;

 background-repeat: repeat;
 background-position: 0 0;
 text-align:center;
 
 
}

.us_Submit_tj {
 border:medium none;
 cursor:pointer;
 height:36px;
 width:101px;
 background-attachment: scroll;
 background-color: transparent;
 background-image: url(image/ssan.jpg);
 background-repeat: repeat;
 background-position: 0 0;
}
-->
</style>
</head>

<body onload="MM_preloadImages('image/more1.jpg')">
<table width="963" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="45">&nbsp;</td>
    <td width="272"><div align="center">
      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"

codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="272" height="203">
        <param name="movie" value="logo.swf" />
        <param name="quality" value="high" />
        <param name="wmode" value="transparent" />
        <embed src="logo.swf" width="272" height="203" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-

shockwave-flash" wmode="transparent"></embed>
      </object>
    </div></td>
    <td width="345" valign="bottom"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="50">
        <form method="post" action="so_zb.asp" target="_top">
        <table width="345" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="81"><img src="image/xwss.jpg" width="81" height="36" /></td>
                        <td width="132" height="50" align="center" valign="middle">
                            <div class="us_Submit_text" align="center">
                              <table width="132" border="0" height="100%">
               
                                <tr>
                                  <td align="center" valign="middle" ><input type="text" name="word"  height="12" style="vertical-

align:middle"class="us_Submit_text1" /></td>
                                </tr>
                              </table>
                 
                            </div>
          </td>
            <td><!--<img src="image/ssan.jpg" width="101" height="36"  />-->
            <input type="submit" value="" name="B1" class="us_Submit_tj">
            </td>
          </tr>
        </table></form>
        </td>
      </tr>
    </table></td>
  </tr>
</table>
<table width="963" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="15">&nbsp;</td>
  </tr>
</table></body>

 

 

用这个还不错 把td设置背景色 把input的边框设置为透明的,没有边框

.sousuo {
 background: url("") no-repeat scroll 0 0 transparent;
 border: medium none;
 height: 29px;
 line-height: 29px;
 padding: 3px 0 0 15px;
 width: 114px;
 text-align: center;
}

 

.us_Submit_text {
 border:medium none;
 cursor:pointer;
 height:29px;
 width:76px;
 background-attachment: scroll;
 background-color: transparent;
 background-image: url(image/button.jpg);
 background-repeat: repeat;
 background-position: 0 0;
 text-align: center;
}


  <td height="29" background="image/ssback.jpg"><input type="text" class="sousuo" value="" id="word" name="word"></td>

<input type="submit" value=""  class="us_Submit_text">

 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:2924次
    • 积分:76
    • 等级:
    • 排名:千里之外
    • 原创:2篇
    • 转载:3篇
    • 译文:0篇
    • 评论:0条
    文章分类
    文章存档