html - html或css中的倾斜对 Angular 线?

标签 html css border css-shapes

我想制作这样的表格 CSS diagonale strike

是否可以在表格中添加倾斜的对 Angular 线边框

最佳答案

基于 CSS3 linear-gradients除了 Angular 不是硬编码的解决方案:

table:nth-of-type(1) td {
  background-image: linear-gradient(
    to top right,
    white 48%,
    black,
    white 52%
  );
}
table:nth-of-type(2) td {
  background-image: linear-gradient(
    to top right,
    papayawhip calc(50% - 1px),
    black,
    papayawhip calc(50% + 1px)
  );
}
/* for testing */
table {
  border-collapse: collapse;
  margin-top: 1em;
  margin-bottom: 1em;
}
td:nth-child(odd) {
  width: 10em;
}
td:nth-child(even) {
  width: 20em;
}
<table border="1">
  <tbody>
    <tr>
      <td>Narrow</td>
      <td>Wide</td>
    </tr>
    <tr>
      <td>Narrow</td>
      <td>Wide</td>
    </tr>
  </tbody>
</table>
<table border="1">
  <tbody>
    <tr>
      <td>Narrow</td>
      <td>Wide</td>
    </tr>
    <tr>
      <td>Narrow</td>
      <td>Wide</td>
    </tr>
  </tbody>
</table>

关于html - html或css中的倾斜对 Angular 线?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28425574/

相关文章:

html - 上边框和左边框相交的像素

html - DIV 透明边框在 IE7 中不显示底层背景

javascript - 无法让这些脚本协同工作

javascript - 内部图像旋转时更改尺寸的父 div

css - 有没有办法过滤掉标有删除线的css样式属性?

jquery - CSS 边框/框阴影挑战

android - 如何用ImageView制作边框?

html - css rem 单元不适用于字体声明

javascript - Circle Pack & Force 布局在同一页上?

javascript - 展开和折叠 html 表中的 3 级分层行