当前位置:网站首页>border影响父元素的高度-解决方案
border影响父元素的高度-解决方案
2022-06-27 09:54:00 【豆浆油条_煎bingo子】
现象:在为Menu组件添加样式时发现,当我点击某个tab时父元素的高度会撑开,原因是boder-bottom设置为2px,第一反应是将border-sizing设置为border-box,使得width和height属性包括内容,内边距和边框,但不包括外边距。但是无效,因为我没有为父元素设置宽高。
1655864862453
.menu{
display: flex;
flex-wrap: wrap;
padding-left: 0;
margin-bottom: 30px;
list-style: none;
border-bottom: $menu-border-width solid $menu-border-color;
box-shadow: $menu-box-shadow;
>.menu-item {
padding: $menu-item-padding-y $menu-item-padding-x;
cursor: pointer;
transition: $menu-transition;
&:hover, &:focus {
text-decoration: none;
}
&.is-disabled {
color: $menu-item-disabled-color;
pointer-events: none;
cursor: default;
}
&.is-active, &:hover {
color: $menu-item-active-color;
border-bottom: $menu-item-active-border-width solid $menu-item-active-color;
}
}
}解决:换一种方法解决,在menu-item添加border-bottom的样式与点击时的样式一样,但颜色设置为transparent就行!
>.menu-item {
padding: $menu-item-padding-y $menu-item-padding-x;
cursor: pointer;
transition: $menu-transition;
border-bottom: $menu-item-active-border-width solid transparent;
&:hover, &:focus {
text-decoration: none;
}
...
1655865242469
边栏推荐
- Freemarker
- dns备用服务器信息,dns服务器地址(dns首选和备用填多少)
- mysql数据库汉字模糊查询出现异常
- 【报名】基础架构设计:从架构热点问题到行业变迁 | TF63
- JS 客户端存储
- std::memory_ order_ seq_ CST memory order
- Only one confirmcallback is supported by each rabbittemplate
- oracle触发器 存储过程同时写入
- [STM32] Hal library stm32cubemx tutorial 12 - IIC (read AT24C02)
- JS array splicing "suggested collection"
猜你喜欢

【报名】基础架构设计:从架构热点问题到行业变迁 | TF63

通俗易懂理解朴素贝叶斯分类的拉普拉斯平滑

mysql数据库汉字模糊查询出现异常

如何获取GC(垃圾回收器)的STW(暂停)时间?

Stop using system Currenttimemillis() takes too long to count. It's too low. Stopwatch is easy to use!

C any() and aii() methods

别再用 System.currentTimeMillis() 统计耗时了,太 Low,StopWatch 好用到爆!

谷歌浏览器 chropath插件

隐私计算FATE-离线预测

【OpenCV 例程200篇】212. 绘制倾斜的矩形
随机推荐
Stop using system Currenttimemillis() takes too long to count. It's too low. Stopwatch is easy to use!
Only one confirmcallback is supported by each rabbittemplate
一次线上移动端报表网络连接失败问题定位与解决
js的数组拼接「建议收藏」
[registration] infrastructure design: from architecture hot issues to industry changes | tf63
unity--newtonsoft.json解析
Arduino PROGMEM静态存储区的使用介绍
详细记录YOLACT实例分割ncnn实现
【报名】基础架构设计:从架构热点问题到行业变迁 | TF63
ucore lab4
基于STM32设计的蓝牙健康管理设备
Five page Jump methods for wechat applet learning
【面经】云泽科技
js 所有的网络请求方式
torch.utils.data.RandomSampler和torch.utils.data.SequentialSampler的区别
openpyxl表格读取实例
flutter 微信分享
强化学习中好奇心机制
2021 CSP J2入门组 CSP-S2提高组 第2轮 视频与题解
Tdengine invitation: be a superhero who uses technology to change the world and become TD hero