当前位置:网站首页>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
边栏推荐
- Use aspese Cells convert Excel to PDF
- 【OpenCV 例程200篇】211. 绘制垂直矩形
- Oracle连接MySQL报错IM002
- Privacy computing fat offline prediction
- R语言plotly可视化:plotly可视化基础小提琴图(basic violin plot in R with plotly)
- Principle and application of the most complete H-bridge motor drive module L298N
- Decompile the jar package and recompile it into a jar package after modification
- 详细记录YOLACT实例分割ncnn实现
- 上周热点回顾(6.20-6.26)
- Source insight 工具安装及使用方法
猜你喜欢
随机推荐
Preliminary understanding of pytorch
感应电机直接转矩控制系统的设计与仿真(运动控制matlab/simulink)
6月23日《Rust唠嗑室》第三期B站视频地址
R语言plotly可视化:plotly可视化二维直方图等高线图、在等高线上添加数值标签、自定义标签字体色彩、设置鼠标悬浮显示效果(Styled 2D Histogram Contour)
Oracle连接MySQL报错IM002
Installation and use of SVN version controller
三层架构中,数据库的设计在哪一层实现,不是在数据存储层吗?
Pakistani security forces killed 7 terrorists in anti-terrorism operation
Multi thread implementation rewrites run (), how to inject and use mapper file to operate database
JS 客户端存储
Privacy computing fat offline prediction
视频文件太大?使用FFmpeg来无损压缩它
unity--newtonsoft.json解析
12 necessary tools for network engineers
unity--newtonsoft.json解析
ucore lab4
新旧两个界面对比
Reorganize common shell scripts for operation and maintenance frontline work
使用aspose-slides将ppt转pdf
openpyxl表格读取实例









