将鼠标悬停在按钮上时更改图像

时间:2018-03-27 14:28:58

标签: css twitter-bootstrap

我整个上午一直在摆弄这个,因为我对JS很新,我没有走得太远。我觉得从这里开始从头开始会更好。

我希望在按钮悬停时切换图像。当前图片为:http://via.placeholder.com/350x150,我们可以更改为:http://via.placeholder.com/200x100

编辑:我没有意识到你可以用纯CSS做到这一点。我会做我的研究,虽然任何做css路线的例子都会受到赞赏。



<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.bundle.min.js" integrity="sha384-feJI7QwhOS+hwpX2zkaeJQjeiwlhOP+SdQDqhgvvo1DsjtiSQByFdThsxO669S2D" crossorigin="anonymous"></script>


<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-6">
<h1>Testing image hover</h1>
<p class="mt-3">Just a test... just a test...</p>

<button class="btn btn-success btn-lg">Test button</button>
</div>

<div class="col-md-6">
<img style="display: width:100vh; height: 90vh;" src="http://via.placeholder.com/350x150">

</div>
</div>
</div>
</body>
&#13;
&#13;
&#13;

0 个答案:

没有答案