css - Background color and background image below element -


the idea make not valid error tip comes when people fail fill out required field show speech bubble. arrowhead image shows in center , underneath text , point field missed.

fiddle here

html:

<span class="wpcf7-not-valid-tip">please fill required field.</span> 

css:

.wpcf7-not-valid-tip {         background: red;         color: white;         padding: 10px;         width: 100px;         background-position: 0 0;          background-repeat: no-repeat;         background-image: url('http://s24.postimg.org/qacevkf7l/green_error_arrow.png');   } 

as can see have background color , arrow image needs sit in middle of element , below but, of course, if position using background-position, image hidden cannot overflow outside of element itself. easy if edit html prefer not using plugin , want free update plugin in future.

question:

is there pure css solution?

if not (and suspect there isnt) cleanest way solve issue? use add_filter alter html put div around tooltip add bg image to? css "content:", js solution?

got answer elsewhere.will accept unless can think of better.

http://jsfiddle.net/d2kfx/2/

this works using css (albeit adding content content: declaration) drawing triangle borders instead of using image it.

css

.wpcf7-not-valid-tip {         background: red;         color: white;         padding: 10px;         width: 100px; } /* updated code */ .wpcf7-not-valid-tip {     position: relative; } .wpcf7-not-valid-tip:after {     top: 100%;     border: solid transparent;     content: " ";     height: 0;     width: 0;     position: absolute;     pointer-events: none;     border-color: rgba(255, 0, 0, 0);     border-top-color: red;     border-width: 10px;     left: 50%;     margin-left: -10px; } 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -