Hyperlinking an image using CSS

后端 未结 10 994
清酒与你
清酒与你 2020-12-11 05:39

I know this is probably the dumbest question ever, however I am a total beginner when it comes to CSS; how do you hyperlink an image on a webpage using an image which is sou

10条回答
  •  隐瞒了意图╮
    2020-12-11 05:54

    You still create links in HTML with 'a' (anchor) tags just like normal. CSS does not have anything that can specify if something is a link to somewhere or not.

    Edit The comments of mine and others still apply. To clarify, you can use JavaScript to make a div act as a link:

    
    

    That isn't really great for usability however as people without JavaScript enabled will be unable to click that and have it act as a link.

    Also, you may want to add a cursor: pointer; line to your CSS to give the header div the correct mouse cursor for a link.

提交回复
热议问题