sách gpt4 ai đã đi

CSS悬停没有文本边距/填充

In lại 作者:行者123 更新时间:2023-11-28 16:19:15 28 4
mua khóa gpt4 Nike

我在导航中添加了悬停效果,遗憾的是悬停也影响了上面的文字。如何在不影响文本位置的情况下向导航添加悬停?

可悲的是,我找不到解决这个问题的方法。

HTML 模板:http://projects.helpful.ninja/BlackzDesignz/Template_example/

CSS 文件:http://projects.helpful.ninja/BlackzDesignz/Template_example/assets/css/style.css

导航栏相关的CSS代码:

ul{
margin: 0px;
padding: 0px;
}

li{
list-style: không có;
}

.navbar_item{
font-family: Calibri;
font-size: 15px;
màu sắc: #fff;
căn chỉnh văn bản: ở giữa;
width:10%;
}

.navbar_item:hover{
color: #1a1a1a;
cursor: pointer;
background-image: url("../images/navbar_hover.png");
background-repeat: repeat-x;
font-weight: đậm;
margin-top: 3px;
}

#navbar_home{
width: 100px;
height: 40px;
line-height: 40px;
background-color: #ffed00;
căn chỉnh văn bản: ở giữa;
margin-left: 10px;
font-family: Calibri;
font-weight: bolder;
font-size: 14px;
color: #212121;
}

有没有人有想法?

1 Câu trả lời

你的问题出在这个css类上,你应该去掉

 margin-top: 3px; 

.navbar_item:hover{
color: #1a1a1a;
cursor: pointer;
background-image: url("../images/navbar_hover.png");
background-repeat: repeat-x;
font-weight: đậm;
! margin-top: 3px; ! //remove this line

现在,每次 悬停 时,文本的边距都会增加 3px。如果您删除它,它将得到解决

关于CSS悬停没有文本边距/填充,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37172422/

28 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com