I need the following field validation effect but I am struggling to come up with the CSS.
Basically at the moment I can show a red info sign at the end of field if it is required (this happens after the form submit happens):
I like this but I would also like a detailed message to appear when you hover over the red exclamation mark - ideally centrally just underneath the input box, like this:
How would I do this? I have started some CSS already but need help to get it finished - see the link below.
You are asking a lot of different things within one question... here are the main points:
Demo: http://jsfiddle.net/LNr6f/1/
1) You have to create an hidden
div
, and show it when you need to trigger the error message (I've used thehover
event as trigger, just adapt it to your needs);2) You can create rounded borders with
CSS border-radius
;3) You can create gradiented backgrounds with CSS, and you are lucky because there is a CSS Gradient Generator out there that will provide a nice Editor and the cross-browser code for you (I've used a simple red background in the example);
4) You have to keep the position of the tooltip related to the textbox one; use
relative
andabsolute
positioning as in the example.5) You need an arrow, that can be an image, but that can be created with pure CSS too, as in the example, using
CSS pseudo-class
:before
(or:after
), with three transparent borders and one colored, collapsing on each others and creating the triangle effect. Then you need to move it out of your div and to center it on the x axis, with the help of absolute positioning.You can start from here, good luck.
Sample HTML
Sample CSS