Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用Css属性设置asp.net C#中文本框内固定的图像位置_C#_Asp.net - Fatal编程技术网

使用Css属性设置asp.net C#中文本框内固定的图像位置

使用Css属性设置asp.net C#中文本框内固定的图像位置,c#,asp.net,C#,Asp.net,我已经创建了一个文本框,我想在其中插入一个图像,在asp.net页面的源代码中使用asp.net C#中的css类属性。我的问题是,当用户连续键入文本时,我的图像会移动。我希望图像位置固定。我尝试了许多选项,比如css中的图像位置固定属性,但没有解决方案。我正在将代码粘贴到下面: <head runat ="server"> <style type="text/css"> .search { background: url('index

我已经创建了一个文本框,我想在其中插入一个图像,在asp.net页面的源代码中使用asp.net C#中的css类属性。我的问题是,当用户连续键入文本时,我的图像会移动。我希望图像位置固定。我尝试了许多选项,比如css中的图像位置固定属性,但没有解决方案。我正在将代码粘贴到下面:

<head runat ="server">

<style type="text/css">

    .search
    {
        background: url('index.jpg') no-repeat;
        padding-left: 25px;
        border:1px solid #ccc;
    }
</style>

.搜索
{
背景:url('index.jpg')不重复;
左侧填充:25px;
边框:1px实心#ccc;
}



我正在使用Internet Explorer进行输出。此浏览器不支持我的编码吗?

添加一个div,将index.jpg设置在适当的位置,现在将textbox放置在该div上,并使用css将outline和border设置为textbox的0px!我的文本框已经在一个div中。我将再次粘贴编码。搜索{background:url('index.jpg')不重复;左填充:25px;边框:1px solid#ccc;}已经在asp.net的页面表单中创建了一个div。如果你有其他意思,请准确指定在何处添加div
<asp:TextBox ID="TextBox2" runat="server" CssClass="search" Width="127px"></asp:TextBox>