0

I am looking for a way to use the hover of css in html file just the way we use style="". Please reply if anybody knows anything about it. I can not use a separate css file or a javascript.

Aditya
  • 11
  • 1
  • 1
  • 1

1 Answers1

2

you cannot simply specify hover inline instead you can write css code inside your html file and assign a class name to it and give the class name to your desired element:

<html>
<head>
<style>
.myClass{
color:red;
}
.myClass:hover{
color:blue;
}
</style>
</head>
<body></body>
</html>
Nishad K Ahamed
  • 1,374
  • 15
  • 25
  • I believe you do not understand the difference between Inline and Embedded. What you have done is called embedded, what the person is looking for is Inline. – Cam Oct 01 '13 at 16:15
  • 2
    @cam yes but Nishad has specified in the answer `you cannot simply specify hover inline ` which is right and answer of the OP – Dhaval Oct 01 '13 at 16:18
  • If ask 2 + 2, i dont want to know 2 x 2, they may equal the same answer but you have changed the formula at which the question was asked. – Cam Oct 01 '13 at 16:20
  • 4
    @Cam Sometimes you need to take in the big picture. From what the OP asked, this might be a solution. This isn't math, it's art and science. – Wesley Murch Oct 01 '13 at 16:24
  • Hey Guys, Thanks for the answer. My problem is that i need to create UI components- accordion, button etc for a client. However the editor provided to me for coding does not allow me to include script tag. I allows me to use inline css and html only. Is it possible to create the component under such circumstances? – Aditya Oct 07 '13 at 11:51