[ Solved -9 Answers ] How to write a:hover in inline CSS
How to use a:hover in inline CSS inside the HTML style attribute?
By adding links to external stylesheets ,
jQuery Code
<script type="text/javascript"> var link = document.createElement("link"); link.setAttribute("rel","stylesheet"); link.setAttribute("href","http://wikitechy.com/yourstylesheet.css"); var head = document.getElementsByTagName("head")[0]; head.appendChild(link); </script>
Caution: the above code assumes there is a head section.
We can get the same effect by changing your styles with JavaScript in the onMouseOver and onMouseOut parameters, although it’s extremely inefficient if we need to change more than one element:
In this case, the inline code: “background-color: yellow;” is the switch color on hover, so we got to put the color we need into there and thereby this solution works.
Wikitechy Founder, Author, International Speaker, and Job Consultant. My role as the CEO of Wikitechy, I help businesses build their next generation digital platforms and help with their product innovation and growth strategy. I'm a frequent speaker at tech conferences and events.