javascript - How do I create Hover effects in HTML without using a CSS page - Stack Overflow

I know that with CSS you can do for example:p:hover {xxx:yyy;}I wish to do so but in the HTML page wit

I know that with CSS you can do for example:

p:hover {
    xxx:yyy;
}

I wish to do so but in the HTML page without linking the CSS, like so:

<p style="xxx">xxxxxxxx</p>

but with the hover option.

I know that with CSS you can do for example:

p:hover {
    xxx:yyy;
}

I wish to do so but in the HTML page without linking the CSS, like so:

<p style="xxx">xxxxxxxx</p>

but with the hover option.

Share Improve this question edited Jan 1, 2014 at 14:24 Matthew Strawbridge 20.7k10 gold badges79 silver badges96 bronze badges asked Jan 1, 2014 at 14:18 BodokhBodokh 1,0764 gold badges18 silver badges34 bronze badges 1
  • 1 see stackoverflow./questions/5293280/… – db9dreamer Commented Jan 1, 2014 at 14:25
Add a ment  | 

3 Answers 3

Reset to default 3

You can insert directly your CSS inside the html page without linking it:

<head>
<style>
    p:hover {
        xxx: yyy;
    }
</style>
</head>
<body>
    <p>xxxxxxxx</p>
</body>

Internal Style Sheet

You can simply use internal css in your html page as below..

<style>
 p:hover{
  //coding...
  }
</style>

Try JavaScript:

<p onmouseover="change(this)" >xxxxx</p>
<script type="text/javascript" >
  function change (element) {
    var style = element.style;
    // Do something with style...
    // Example: style.color = "red";
  }
</script>

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744177982a4561845.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信