Form Field Elements Having Icon Inside It - FormGet
Có thể bạn quan tâm
This code segment emphasize on creating input form elements that consists of Icons. There is Email field, Name Field, Contact Name and Address fields so we have to put icon inside the form fields.

To put icon inside the form field, we have to fetch form field using id and then use CSS to set background inside the form fields using it’s background properties :
background-image:url(.....); background-repeat:no-repeat; background-position:6px;
So, just view its Live Demo , download the code and attach it to your website to make it attractive.
![]()
HTML File: formicon.html
We are creating a contact form using HTML. Form is defined in Div name “first”.
<!DOCTYPE html> <html> <head> <title>Icon inside Input Field - Demo Preview</title> <meta content="noindex, nofollow" name="robots"> <link href="css/formicon.css" rel="stylesheet"> </head> <!-- Include CSS File Here --> <body> <div id="first"> <img id="logo" src="images/logo.png"> <label>Full Name :</label> <input id="fname" placeholder="Full Name" type="text"> <label>Email :</label> <input id="email" placeholder="Email" type="text"> <label>Contact Number :</label> <input id="contact" placeholder="Contact Number" type="text"> <label>Address :</label> <input id="address" placeholder="Address" type="text"> <input id="submit" type="submit" value="Submit"> </div> </body> </html>CSS File: formicon.css
Styling form fields elements and placing icons inside it .
/* Below line is used to import font-family: Raleway from Google Fonts (optional)*/ @import "http://fonts.googleapis.com/css?family=Raleway"; body{ font-family:'Raleway',sans-serif } img#logo{ margin-left:90px } div#first{ width:350px; height:auto; margin:50px auto 0; padding:20px 25px; background-color:#EEE; color:#333; border:2px solid #C2D6FF; border-radius:5px; border-radius:40px 0 40px 0 } label{ font-size:15px; font-weight:700 } input#fname{ background-image:url(../images/icon_name.png); background-repeat:no-repeat; background-position:6px; border:1px solid #DADADA; margin-top:10px; padding-left:35px; width:310px; height:30px; font-size:14px; box-shadow:0 0 10px; -webkit-box-shadow:0 0 10px; /* For I.E */ -moz-box-shadow:0 0 10px; /* For Mozilla Web Browser*/ border-radius:5px; -webkit-border-radius:5px; /* For I.E */ -moz-border-radius:5px /* For Mozilla Web Browser*/ } input#email{ background-image:url(../images/email.png); background-repeat:no-repeat; background-position:6px; border:1px solid #DADADA; margin-top:10px; padding-left:35px; width:310px; height:30px; font-size:14px; box-shadow:0 0 10px; -webkit-box-shadow:0 0 10px; /* For I.E */ -moz-box-shadow:0 0 10px; /* For Mozilla Web Browser*/ border-radius:5px; -webkit-border-radius:5px; /* For I.E */ -moz-border-radius:5px /* For Mozilla Web Browser*/ } input#contact{ background-image:url(../images/mobile.png); background-repeat:no-repeat; background-position:6px; border:1px solid #DADADA; margin-top:10px; padding-left:35px; width:310px; height:30px; font-size:14px; box-shadow:0 0 10px; -webkit-box-shadow:0 0 10px; /* For I.E */ -moz-box-shadow:0 0 10px; /* For Mozilla Web Browser*/ border-radius:5px; -webkit-border-radius:5px; /* For I.E */ -moz-border-radius:5px /* For Mozilla Web Browser*/ } input#address{ background-image:url(../images/home.png); background-repeat:no-repeat; background-position:6px; border:1px solid #DADADA; margin-top:10px; padding-left:35px; width:310px; height:30px; font-size:14px; box-shadow:0 0 10px; -webkit-box-shadow:0 0 10px; /* For I.E */ -moz-box-shadow:0 0 10px; /* For Mozilla Web Browser*/ border-radius:5px; -webkit-border-radius:5px; /* For I.E */ -moz-border-radius:5px /* For Mozilla Web Browser*/ } input#submit{ background-color:#FF9980; border-radius:5px; border:none; padding:10px 25px; color:#FFF; text-shadow:1px 1px 1px #949494; margin-left:120px } input#submit:hover{ background-color:#80A24A }
Conclusion:
So, in this blog post we have learned to place icons inside the form fields elements. Hope you find it easy if have any issues do reply in the comments.
Have a look on some more related stuffs –
- CSS Background
- 12 Inspiring Form Designs You Will Love To See
Related Posts:
How To Make Simple Responsive Form Using CSS/HTMLAttractive Form Button Design Irresistible To Avoid (With PSD)12 Inspiring Form Designs You Will Love To See (With PSD)Từ khóa » Html Field Icons
-
How To Create A Form With Icons - W3Schools
-
Put Icon Inside Input Element In A Form - Html - Stack Overflow
-
CSS To Put Icon Inside An Input Element In A Form - GeeksforGeeks
-
How To Add Icons Inside Input Elements In HTML
-
Formatting Icons For The HTML Field Editors
-
Try It Live - Adding Icons Inside And Outside Of Input Text In Forms
-
Input With Icon - OutSystems 11 Documentation
-
How To Add Icons To The Right Inside Html Input Fields Code Example
-
How To Add Font Awesome Icons To Your Input Fields - Solodev
-
How To Use ICONS In Form Fields Properly - YouTube
-
How To Add Icons Inside HTML Input Fields - YouTube
-
CSS To Put Icon Inside An Input Element In A Form - Tutorialspoint
-
Text Fields - Material Design
-
Create A Search Icon Inside Input Box With HTML And CSS