当前位置:网站首页>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
边栏推荐
- [200 opencv routines] 212 Draw a slanted rectangle
- 微信小程序学习之五种页面跳转方法.
- 别再用 System.currentTimeMillis() 统计耗时了,太 Low,StopWatch 好用到爆!
- 隐私计算FATE-离线预测
- Es update values based on Index Names and index fields
- Decompile the jar package and recompile it into a jar package after modification
- Freemarker
- leetcode:522. Longest special sequence II [greed + subsequence judgment]
- Technology is as important as business. It is wrong to favor either side
- unity--newtonsoft.json解析
猜你喜欢
Apache POI的读写
为智能设备提供更强安全保护 科学家研发两种新方法
如何获取GC(垃圾回收器)的STW(暂停)时间?
Use aspese slides to convert PPT to PDF
基于STM32设计的蓝牙健康管理设备
Your brain is learning automatically when you sleep! Here comes the first human experimental evidence: accelerate playback 1-4 times, and the effect of deep sleep stage is the best
小哥凭“量子速读”绝技吸粉59万:看街景图0.1秒,“啪的一下”在世界地图精准找到!...
通俗易懂理解樸素貝葉斯分類的拉普拉斯平滑
【系统设计】邻近服务
你睡觉时大脑真在自动学习!首个人体实验证据来了:加速1-4倍重放,深度睡眠阶段效果最好...
随机推荐
leetcode:968. Monitor the binary tree [tree DP, maintain the three states of each node's subtree, it is very difficult to think of the right as a learning, analogous to the house raiding 3]
导师邀请你继续跟他读博,你会不会立马答应?
R langage plotly visualisation: visualisation de plusieurs histogrammes normalisés d'ensembles de données et ajout d'une courbe de densité KDE à l'histogramme, réglage de différents histogrammes en ut
Xiaobai can also understand how the basic network 03 | OSI model works (classic push)
新旧两个界面对比
Use CAS to complete concurrent operations with atomic variables
为智能设备提供更强安全保护 科学家研发两种新方法
Use aspese slides to convert PPT to PDF
视频文件太大?使用FFmpeg来无损压缩它
你睡觉时大脑真在自动学习!首个人体实验证据来了:加速1-4倍重放,深度睡眠阶段效果最好...
vector::data() 指针使用细节
Freemarker
Advantages and disadvantages of distributed file storage system
C语言学习-Day_05
Bluetooth health management device based on stm32
反编译jar包,修改后重新编译为jar包
详细记录YOLACT实例分割ncnn实现
leetcode:522. 最长特殊序列 II【贪心 + 子序列判断】
三层架构中,数据库的设计在哪一层实现,不是在数据存储层吗?
感应电机直接转矩控制系统的设计与仿真(运动控制matlab/simulink)