Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Robert Tyree
Robert Tyree
13,335 Points

How can I target a text/H1 element when a touch-enabled device scrolls? Can I mimic a :hover pseudo-class?

On my student page at tyreer.com, I'm trying to make the text white whenever anyone touches their screen on a touch-enabled device.

Essentially, I'd like to apply the same declaration as the :hover pseudo-class in the CSS below.

I've searched around on a few forums, but it's still early days for me and the threads I've come across are way over my head. Does anyone know a method for making the H1 text white when a screen is touched?

Thanks so much any tips!

___________HTML

<!DOCTYPE html> <html> <head> <title>tyreer.com</title> <link rel="stylesheet" href="css/style.css"> <meta name="viewport" content="width=device-width"> </head> <body> <h1>Almost alive</h1> </body> </html>

___________CSS

/* Web Fonts -------------------- */

@font-face { font-family: 'Lobster'; src: url('../fonts/Lobster_1.3.otf');

}

/* Base Styles -------------------- */

  • { box-sizing: border-box; }

h1 { font-family: 'Lobster', Helvetica, Arial, sans-serif; font-size: 10em; font-size: 20vw; text-align: center; font-weight: 200; width: 75%; /* max-width: 100%;/ margin: auto; padding: none; / border: solid 2px red; */ margin-top: 80px; margin-top: 10vw; }

h1:hover { color: white; }