So i have a Div at the center of an image. I have css to increase the brightness of the image on hover but when mouse is on the text it doesnt work. Can i make it work somehow?
The problem is the text is covering the image, so when the cursor is over the text, it is hovering the text, not the image.
The trick is to put them both in a common parent container and use the hover pseudo class on that.
The other problem is you are using the webkit prefix, but no version without the prefix, so for non-webkit browsers, it does not work.
If you do use prefixes, always follow them with non-prefixed versions.
In addition to SamA74’s observations, there is no valid doctype at the top of the page. Without a valid doctype, all bets of consistent cross-browser behaviors are off.
When coding, spelling matters. “heigh” is not a valid spelling of “height”.
You might want to try a small addition to SamA74’s code to prevent the text from being selectable…
.textOnImage {pointer-events:none;}
One final remark, do not expect anyone to enjoy scrolling offscreen to the right to view your CSS. It is far better to write your CSS indented rather than inline during the development stage and when asking for help. If it were a long, complicated page with long lines of inline CSS, it is possible that people would not be interested in it. We’re only human. (don’t believe him)