screen_rotation
Copied to Clipboard
<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/vue@3.2.12/dist/vue.global.js"></script> </head> <body> <div id="app"> <h3>Vue Js Show image on hover link</h3> <a href="#" @mouseover="showImage = true" @mouseout="showImage = false">Hover me</a> <img v-if="showImage" src="https://www.sarkarinaukriexams.com/images/editor/1684089154spacex-g93fad4d75_640.jpg" alt="Hovered Image"> </div> <script type="module"> const app = Vue.createApp({ data() { return { showImage: false }; }, }); app.mount('#app'); </script> <style> #app { text-align: center; box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.12), 0 2px 4px 0 rgba(0, 0, 0, 0.24); width: 600px; margin: 0 auto; transition: transform 0.3s ease; } h3 { margin-bottom: 10px; } /* Anchor tag styles */ a { display: inline-block; padding: 10px 20px; border: 1px solid #ccc; text-decoration: none; color: #333; border-radius: 4px; transition: background-color 0.3s ease; } a:hover { background-color: #f5f5f5; } /* Image styles */ img { max-width: 500px; height: auto; width: 100%; transition: opacity 0.3s ease; } </style> </body> </html>