CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 4th, 2012, 06:10 AM
andreea115 andreea115 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Posts: 48 andreea115 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 2 m 36 sec
Reputation Power: 2
How do u place a rounded corner image on top of a imput field

Hi everyone

i am not sure if this is the right place to ask this.

i used Fireworks to draw an imput button for my login form ( i build it with rounded corners). i now want to tranfer this to my actual imput filed box on my site.

i now have two questions.

1 how do i place the imput image over the actual imput field; i mean, what is the best way to do it.


2. i want the imput filed to change colour once a mouse hovers over it. Is there anyway to do that in CSS or must it only be done in Jquery/javascript.

thanks for your help everyone.

warm regards

Andreea

Reply With Quote
  #2  
Old October 5th, 2012, 03:09 PM
YellowBricks YellowBricks is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Location: Hannover, Germany
Posts: 11 YellowBricks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 54 m 33 sec
Reputation Power: 0
are you trying to do something like this:
html Code:
Original - html Code
    <input type="button" value="A Button" class="my_button" />


and it showing the image?

If so, you could archive that through CSS:

CSS Code:
Original - CSS Code
  1.  
  2. .my_button {
  3.     background: url('path/to/image/file') center no-repeat;
  4.     border: 0;
  5.     padding: 0;
  6.     width: [image width];
  7.     height: [image height];
  8.     line-height: [image height];
  9. }


You could then easily add a :hover pseudo class to change the image to a hover state:

CSS Code:
Original - CSS Code
  1.  
  2. .my_button:hover {
  3.     background: url('path/to/image/file_hover') center no-repeat;
  4. }


This technique could be used for any type of element.
Is is this what you were trying to do?

Reply With Quote
  #3  
Old October 6th, 2012, 01:37 AM
andreea115 andreea115 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2012
Posts: 48 andreea115 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 10 h 2 m 36 sec
Reputation Power: 2
Hello everyone.

special thanks to YellowBricks for his responce.

i think that this pretty much asnwers my question.

i just have one further question.

the image that will be placed on top of the imput box i.e:

<input type="button" value="A Button" class="my_button" />

would it have to be two images. i.e the part that covers the top part of the imput button and then a part to cover the bottom part of the image.

if not, then how do you create an image that has an empty area in the middle of the image taht would enable user to type into it. ( you will note that imput fileds have an area in which users can type into it.

warm regards

Andreea


Quote:
Originally Posted by YellowBricks
are you trying to do something like this:
html Code:
Original - html Code
    <input type="button" value="A Button" class="my_button" />


and it showing the image?

If so, you could archive that through CSS:

CSS Code:
Original - CSS Code
  1.  
  2. .my_button {
  3.     background: url('path/to/image/file') center no-repeat;
  4.     border: 0;
  5.     padding: 0;
  6.     width: [image width];
  7.     height: [image height];
  8.     line-height: [image height];
  9. }


You could then easily add a :hover pseudo class to change the image to a hover state:

CSS Code:
Original - CSS Code
  1.  
  2. .my_button:hover {
  3.     background: url('path/to/image/file_hover') center no-repeat;
  4. }


This technique could be used for any type of element.
Is is this what you were trying to do?

Reply With Quote
  #4  
Old October 6th, 2012, 05:45 AM
YellowBricks YellowBricks is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2012
Location: Hannover, Germany
Posts: 11 YellowBricks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 54 m 33 sec
Reputation Power: 0
If you want users to be able to type then you need an input field of type text (or password, email, etc.):

html Code:
Original - html Code
    <input type="text" class="text_input" />


which you would then styled as before by targeting the .text_input class (or all <input>s; as you choose).

However, I would recommend recreating the image in CSS, if you can live with it not looking perfect in (older versions of) Internet Explorer (although there are also workarounds for that).
Gradients and rounded corners can easily be recreated in pure CSS:

(note, I am only using unprefixed version, google for support)
css Code:
Original - css Code
  1. .text_input {
  2.     background: linear-gradient(to bottom, #a90329 0%,#8f0222 44%,#6d0019 100%);
  3.     border-radius: 5px;
  4. }


To easily create gradients in CSS, look at this awesome tool, which also spits out all the prefixed versions for easy copy and paste: http://www.colorzilla.com/gradient-editor/.

Just to sum things up:
There are different types of <input>s. In my first example I used a button, which is used for clicking. "text" for regular text inputs and "password" for "hiding" the users input.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > How do u place a rounded corner image on top of a imput field

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap