Home > database >  How do I make an image a href from this code?
How do I make an image a href from this code?

Time:04-29

So I have this web page, here's what it looks like:

https://prnt.sc/vY4OUXrUpnr9

now I want to make the center image a link. So when they click it they are redirected to a download. Here's the current code below in index.html but I don't know what to add/how to make the image a link. I think it's something to do with href. Please let me know, but need this done.

<style type="text/css">
        body{
            background-color: #484848;
        }
        div.container{
                text-align: center;
                position: absolute;
                top: 45%;
                left: 42.5%;
        }
        div.container img{
            width: 70px;
        }
        div.container p{
            color: #fff;
            font-size: 12px;
            font-family: sans-serif;
        }
    </style>
</head>
<body>
<div >
    <img src="img/error.png">
    <p>A plugin is needed to display this content.</p>
</div>

<!-- page content end -->
</body>
</html>

CodePudding user response:

Change it to


<div >

    <a href="http://example.com">

        <img src="img/error.png">
        <p>A plugin is needed to display this content.</p>

    </a>

</div>

CodePudding user response:

<a href="https://www.google.de"><img src="https://img001.prntscr.com/file/img001/UAcHefR6SIeX5mTnHUmcdg.png" width="200" height="100">
<p>A plugin is needed to display this content.</p>
</a>
  • Related