html - 为什么这条轻微的红线保留在父容器中?
问题描述
细线没有消失,我已将子 div 设置为白色并将其宽度设置为 50%,但我不知道如何覆盖左侧的那条红线!
body{
height: 100vh;
position: relative;
}
.main-container{
width: 70%;
height: 50vh;
background: red;
/* below these styling are just for adjusting the element on the screen
for ease of styling & visibility change it for final usage */
position: absolute;
left: 50%;
top: 15%;
transform: translateX(-50%);
/* till here */
}
.left {
width: 50%;
height: 100% !important;
background: white ;
}
<div class="main-container"><div class="left"></div></div>
解决方案
嗨,解决此问题的最快方法是应用-1px 左侧的边距来覆盖它。
.left {
width: 50%;
height: 100% !important;
background: white;
margin-left: -1px;
}
推荐阅读
- ruby - ruby-kafka 读取所有消息主题并退出
- php - 使用 IFNULL 或 COALESCE 时,通过汇总分组不会将列名更改为 TOTAL
- node.js - (heroku) 错误 R10 (启动超时) -> Web 进程未能在启动后 60 秒内绑定到 $PORT
- javascript - 打字机效果及链接
- mysql - 云 sql 未在表中显示正确的数据
- c++ - 函数在不同的配置上返回不同的值
- javascript - 在 Async/Await 下留下无用的同步代码是一种反模式吗?
- sql - SQL任务帮助请
- dns - 什么是 ICANN 域状态:“clientTransferProhibited”?
- python - 为什么在运行时不会移动文件?