[英]How do i make whole area clickable
Creating a navigation bar.创建导航栏。 How do i make the whole area around the text not just the text clickable?如何使文本周围的整个区域不仅仅是可点击的文本? I put display: block;我把 display: block; and it still does not work.它仍然无法正常工作。 Now I'm just writing anything so i could post the question.现在我只是在写任何东西,所以我可以发布问题。 Thank you!谢谢!
.containter{
width: 80%;
margin: 0 auto;
}
header{
background: deeppink;
}
header::after{
content:'';
display: table;
clear: both;
}
.logo{
float: left;
padding: 10px 0;
margin-left: 5px;
}
nav{
float: left;
}
nav ul{
margin:5px;
padding:0;
list-style: none;
overflow: hidden;
}
nav li{
float: left;
display: block;
margin-left: 100px;
padding-top: 27px;
}
nav a{
text-decoration: none;
color: white;
text-transform: uppercase;
font-family: times new roman;
text-align: center;
display: block;
}
nav a:hover{
background-color: #C71585;
}
For making the area clickable you can use pointer events property of css like为了使该区域可点击,您可以使用 css 的指针事件属性,例如
div {
pointer-events: none;
}
div{
pointer-events: auto;
}
div{
pointer-events: all;
}
Can try it out if it works for you none will disable the mouse click where as auto and all will allow the mouse click..!!如果它对你有用,可以试试看,没有一个会禁用鼠标点击,而所有的都会允许鼠标点击..!!
try to change to these two尝试更改为这两个
nav li{
float: left;
display: block;
}
nav a{
text-decoration: none;
color: white;
text-transform: uppercase;
font-family: times new roman;
text-align: center;
display: block;
margin-left: 100px;
padding-top: 27px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.