How can I make my and the first try didn't work at all, and the second code just made the div's flash and dissappear partially. CSS3 solution: Im content Using CSS you can add a hover style to the div: See this jsFiddle for a demonstration. jQuery Solution Another option that might work for you is jQuery. It's a JavaScript library that simplifies commonly needed functionality such as this. Using jQuery, you can easily add hover effects to the elements: See this jsFiddle for a demonstration. I did something like this for a similar problem (you can change the scale to whatever works for you): Note that this will scale both the div and its content, which I think is what you want.size: 150%;
height: +30px; width: +30px;
回答1:
div { background: #999; width: 200px; height: 20px; transition: width 1s; } div:hover{ width: 300px; }
回答2:
div.container { width: 80%; background-color: blue; } div.container:hover { width: 100%; background-color: red; }
//hover effect applies to any elements using the 'container' class $(".container").hover( function(){ //mouse over $(this).width($(this).width() + 30); }, function(){ //mouse out $(this).width($(this).width() - 30); } );
回答3:
div:hover { -webkit-transform: scale(1.1); -moz-transform: scale(1.1); -o-transform: scale(1.1); -ms-transform: scale(1.1); }
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
elements grow (and the content changes text size to a higher one), when hovered over? I put them in a class and tried: