Text input with background image

E-mail Print PDF

Text input with background image

In this article we are going to see how to add Text input with background image. We're now going to see how you can create an input box like the one you see below:

Live Demo...

Text input with background image


All we need in order to create an input box like above we required image which we want to use as background and some CSS code.

You can find required images with Source code download section.
Put following piece of code in the head section, <head>… ___ …</head> tag of your web page. This input box is simply created by adding a background image to the input tag. You can also use padding so that the text doesn't overlap the background image. I have used it for inputboxSearch  and inputboxStar

 This is an example of the CSS:

(Code 1)

<style type='text/css'>

.inputboxUsr {
width: 150px;
margin: 0 0 1em 0;
border: 1px solid #333333;
background:url('img/bginputusr.gif') no-repeat right top;
}

.inputboxPwd {
width: 150px;
margin: 0 0 1em 0;
border: 1px solid #333333;
background:url('img/bginputpwd.gif') no-repeat right top;
}

.inputboxSearch {
width: 150px;
margin: 0 0 1em 0;
border: 1px solid #333333;
background:url('img/magnifying-glass.gif') no-repeat right center;
padding-right:20px;
}

.inputboxStar {
width: 150px;
margin: 0 0 1em 0;
border: 1px solid #333333;
background:url('img/lg_input_full.gif') no-repeat left center;
padding-left:20px;
}

</style>


Now put the below piece of code in body section <body>… ___ …</body> tag of your web page. simply assign our input tag to the CSS class as…


<form id="loginForm" name="loginForm" method="post">
<input class="inputboxusr" type="text" size="15" name="usrname" />
<input class="inputboxpwd" type="password" size="15" value="" name="pass" />
<input class="inputboxSearch" type="text" size="15" value="" name="search" />
<input class="inputboxStar" type="text" size="15" value="" name="star" />
</form>


Source Code:

Download Source code for ' Text input with background image '

Download

Trackback(0)
Comments (3)Add Comment
Long text comes over images
written by DocQ, October 28, 2008
to fix subject add padding-(left|right) depending on which side is image place
Thanks
written by Werbetechnik, November 18, 2009
Now my input-boxes look stylish smilies/smiley.gif
Thanks!
Thanks
written by Sinfocol, November 24, 2009
Thanks for the article, I was searching something like this to put on my input boxes.
Great Work! smilies/smiley.gif

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

busy
Last Updated ( Thursday, 28 February 2008 15:43 )  

Who's Online

We have 11 guests online

Subscribe Feeds

Enter your email address:

Sponsor Adds


 
 

Submit Article

We want to develop such a Community portal which will provide a good resource on latest hot technologies such as .NET, VB.NET, C#.NET, ADO.NET, ASP.NET, PHP, Flash, Photoshop. If you like to write for us, this guideline for you. please send your article, faqs on admin[at]xfunda.com

Adobe Gallery Photoshop Tutorials...

Photoshop Tutorial - Create Colorful Composition in Photoshop Photoshop Tutorial - Create Colorful Composition in Photoshop Photoshop Tutorial - Create Colorful Composition in Photoshop Category - Photoshop >> illustration and Art. ...
 
Photoshop Tutorial - Create a Nice Autumn Scenery in Photoshop Photoshop Tutorial - Create a Nice Autumn Scenery in Photoshop Photoshop Tutorial - Create a Nice Autumn Scenery in Photoshop Category - Photoshop >> illustration and Art. ...
 
Photoshop Tutorial - Create a Beautiful Lonely Fantasy Fairy Photoshop Tutorial - Create a Beautiful Lonely Fantasy Fairy Photoshop Tutorial - Create a Beautiful Lonely Fantasy Fairy Category - Photoshop >> illustration and Art. ...
 
Photoshop Tutorial - How To Create a Futuristic Sci-Fi Scene Photoshop Tutorial - How To Create a Futuristic Sci-Fi Scene Photoshop Tutorial - How To Create a Futuristic Sci-Fi Scene Category - Photoshop >> Photo Effects. ...
 
Photoshop Tutorial - Goddess cadeira photo effect in Photoshop Photoshop Tutorial - Goddess cadeira photo effect in Photoshop Photoshop Tutorial - Goddess cadeira photo effect in Photoshop Category - Photoshop >> Photo Effects. ...