Nested hyperlinked areas without nested link elements in HTML source

后端 未结 5 2094
被撕碎了的回忆
被撕碎了的回忆 2021-02-02 16:11

I\'d like to have something that looks and behaves as hyperlink inside larger rectangle (full page wide) which is also hyperlink. Below there is ASCII-art representation of what

5条回答
  •  孤街浪徒
    2021-02-02 17:06

    Just place on onclick event handler on the outer element which when clicked calls "window.location ='yourURLhere';"

    You could add a style attribute - "cursor:pointer" to get the hand cursor when mouse over.

    You could also have a css hover code block to get the colour changes.

    EDIT: just realised no javascript, so in that case, keep the 'a' tag and simply define a style for it in css, that way you can give it height, width, etc.

提交回复
热议问题