css - 带有 :before 和 z-index 的边界半径之外的 CSS 背景
问题描述
我正在尝试使用:before 和 z-index 在边界半径之外设置背景颜色。
问题是border-radius css start应该是一个圆圈,右侧后面应该是浅绿色以连接到html元素2,但它不起作用。
任何建议如何使它工作?
td {
width:40px;
height:40px;
text-align: center;
background-clip: padding-box;
-webkit-background-clip: padding-box;
}
.middle {
background-color: #b2edd6;
}
td.start {
border-radius: 50%;
background-color: #00AA6C;
color: white;
z-index: 1;
position: relative;
}
td.start:before {
content: "";
background-color: #b2edd6;
width: 50%;
height: 100%;
position: absolute;
top: 0;
left: 50%;
z-index: -1;
}
<table style='table-layout:fixed;border-collapse: collapse;'>
<tbody>
<tr>
<td class='start'>1</td>
<td class='middle'>2</td>
<td>3</td>
</tr>
</tbody>
</table>
解决方案
推荐阅读
- python - Kivy - ScrollView 内部的 GridLayout 内部的 FloatLayout 对齐问题
- php - 删除laravel中的一些文本
- react-native - 如何在 React Native 中修复页面流之外的元素位置?
- java - 如何在 Java 中结合 SourceWithContext 和 SourceQueue 的功能?
- visual-studio-code - VSCode:SFTP上传文件不适用于一个文件夹
- reactjs - npm run build 不包括所有文件
- python - 在 MacOS 上使用 pathlib.Path 正确转义 Windows 路径
- android - Flutter:我想将 Flutter 应用程序注册(连接)到 Firebase,但我无法使用 android 模拟器注册(连接)
- python - 如何从 html 中提取价格并存储到变量中?
- ruby-on-rails - Rails 访问地理编码器::计算