Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7808925
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:16:37+00:00 2026-06-02T03:16:37+00:00

I am having a normal asp.net text box with a background image with properties

  • 0

I am having a normal asp.net text box with a background image with properties as shown below:

.userbackground
{
    background-image: url('../images/user.png');
    background-repeat: no-repeat;
    background-position: fixed;
    text-align:center;
    width:16px;
    height:16px;
}

This is the view of my textbox:

enter image description here

And here is my textbox:

 <asp:TextBox ID="UserName" runat="server" BorderStyle="Solid" BorderWidth="1px" 
 BorderColor="#0099CC" BackColor="#FAFFBD" MaxLength="0" 
 AutoCompleteType="Disabled" CssClass="userbackground"></asp:TextBox>

Now I would like to know is there any possiblity to set the margin for the inside text or place the cursor position after that image and if user clears the text inside the cursor should stop before the image.

I have tried using css properties: text align:middle but it starts from the center and I don’t want that and making a background image also dosen’t suits my needs.showing and hiding image also is not a good option in my case as I have many.Other than these three options anyone can opt me the best way I am really glad to hear them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T03:16:39+00:00Added an answer on June 2, 2026 at 3:16 am

    You could put the textbox in a div with a background-image, and position the textbox with padding so that it doesn’t overlap the image:

    ​.textbox
    {
     background-image:url('http://placehold.it/15/15');   
     background-repeat:no-repeat;
     background-position:3px 3px;
     border:solid 1px black;
     border-radius: 5px;
     padding-left:20px;
     width:200px;
    }
    .textbox input
    {
     border:none;
     background:transparent;
     width:100%;     
     outline: none; //removes orange border in google chrome
    }
    

    — SEE DEMO —

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an Asp.Net web page, having the common Asp.Net form. The outer border
i'm having a bit of a weird problem. I programmed a asp.net mvc app
I have existing ASP.NET MVC View pages and View user controls which I currently
I've been having really bad memory problems with an ASP.NET Application. It seems as
I have a function that generates normal random number matrix having normal distribution using
I want to extend the asp.net validators such that I can make one validator
To learn ASP.net I started building a todo web app(web forms not MVC), this
I've got an ASP.NET page that takes a long time to download and returns
I have an ASP.NET MVC 2 form that is working perfectly, doing client side
I'm working on a ASP.NET MVC2 project, for which I have configured the localisation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.