tooth-paste Posted February 18, 2016 Share Posted February 18, 2016 Hope anyone can help with a none PW related issue. I thought this was going to be simple but in the mean time I'am pulling my hairs out. I want to place text over an image. This I got working. See the included image and css. The problem is that I want the text to underline on mouse over. <div class="image"> <img src="<?php echo $config->urls->templates; ?>img/image.jpg" alt="" /> <h2><span>Test</span></h2> </div> .image{position: relative;width:100%} h2, .caption{position:absolute;top:0;left:3%;width:100%} h2 span{font-size:15px;font-weight:normal;color:#fff;letter-spacing:-1px;background:rgb(0, 0, 0);background:rgba(0, 0, 0, 0.7);padding:2%} Link to comment Share on other sites More sharing options...
BitPoet Posted February 18, 2016 Share Posted February 18, 2016 That is what the :hover pseudo class is for. span.caption:hover { text-decoration: underline; } Link to comment Share on other sites More sharing options...
tooth-paste Posted February 18, 2016 Author Share Posted February 18, 2016 Adding the caption messes up the design. Did you mean like this <h2><span class="caption">Test</span></h2> Link to comment Share on other sites More sharing options...
BitPoet Posted February 18, 2016 Share Posted February 18, 2016 Sorry, didn't look closely enough. I meant h2 span:hover { text-decoration: underline; } Though for that kind of styling you should always use classes or ids to avoid styling unrelated content. I'm assuming here that you want the text to underline when you hover over it. If you want to style the text on hovering over the image, it's a completely different topic. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now