Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html 使整个div成为超链接_Html_Css_Hyperlink - Fatal编程技术网

Html 使整个div成为超链接

Html 使整个div成为超链接,html,css,hyperlink,Html,Css,Hyperlink,如何使整个paddiv区域成为超链接 这是我的HTML: <div class="pad"> <div href="http://www.google.com" style="height:286px;width:286px;background:url('http://placehold.it/1x1') top center no-repeat;background-size:cover"> <div>

如何使整个
pad
div区域成为超链接

这是我的HTML:

    <div class="pad">
    <div href="http://www.google.com" style="height:286px;width:286px;background:url('http://placehold.it/1x1') top center no-repeat;background-size:cover">
        <div>
            <span>View all</span>
        </div>
    </div>
</div>

查看所有

把整个东西都挂上标签


把整个东西都挂上标签

使用“onclick=”事件而不是href

<div onclick="document.location='http://www.google.com'> ...
使用“onclick=”事件而不是href

<div onclick="document.location='http://www.google.com'> ...

此问题中没有javascript标记,但它应该可以工作?此问题中没有javascript标记,但它应该可以工作?如果您在div中输入a并给出style display:block;宽度:100%更好,因此div.pad的位置将与以前相同。您可以通过破解css使其消失,但这个问题没有要求这样做。这非常好。从语义上讲,它是正确的吗?或者在关闭代码< >代码>之前,我应该考虑使用<代码> <代码>标签,并将此强制为<代码>宽度:100%;高度:100%
?取决于您想做什么。这在语义上是合理的。请用小提琴,看看会发生什么!如果您在div中输入a并给出样式显示:block;宽度:100%更好,因此div.pad的位置将与以前相同。您可以通过破解css使其消失,但这个问题没有要求这样做。这非常好。从语义上讲,它是正确的吗?或者在关闭代码< >代码>之前,我应该考虑使用<代码> <代码>标签,并将此强制为<代码>宽度:100%;高度:100%
?取决于您想做什么。这在语义上是合理的。请用小提琴,看看会发生什么!