Is there a way to add :hover pseudoclass, without CSS file or <style>, using:

<div style="CSS rules here">DIVie</div>

?

Recommended Answers

All 2 Replies

I dont beleive there is any inline equivalent for these pseudo-selectors even though a W3C draft from 2002 indicates yes... Syntax of CSS rules in HTML's "style" attribute

You could use javascript instead..

<div onMouseOver="this.style.backgroundColor='yellow'" onMouseOut="this.style.backgroundColor='#FFFFFF'">DIVie</div>

I think there is a possible walkthrough because I have made something similar using classes and hovering the class. That means that if you assign the css code of the class to your in-line style rules then propably you will do the trik (of course using the syntax of the link above).
Tasos Drosiadis

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.