壁画边框样式:表CSS样式| 边框(table css styles)

关于壁画边框样式的问题,在table css styles中经常遇到, 我真的需要一些 CSS 的帮助。

我真的需要一些 CSS 的帮助。

我试图风格表,我有困难添加边框。

这是我要的表格样式(Photoshop):https://ibb.co/hFkCkDg

在表周围添加边框很简单:

.table-class {
    border: 1px solid #dddddd !important;
    padding: 20px !important;
    border-radius: 5px;
}

截图:https://ibb.co/Fs6qsNv

要在表中添加分隔线,我需要在表中的行添加顶部或底部边框。行是tr元素。默认情况下,表的tr元素不接受边框。因此,为了克服这个问题,我在整个表中添加了{border-collapse: collapse !important;},这允许我在行 /周围添加边框。截图:

由于{border-collapse: collapse !important;},属性borderpaddingborder-radius不适用于表。

这意味着我可以在整个表周围添加边框或添加分隔线,但不能同时添加。

我怎样才能实现我要的外观?

3

我会使用 flexbox,并将flex: 1flex-grow: 1设置为每个“行”第一个子

* {margin:0; box-sizing: border-box;}
body {font: 16px/1.4 'Varela Round', sans-serif; padding: 20px;} /* DEMO ONLY */
/*
  Order
*/
.Order {
  border-radius: 5px;
  border: 1px solid #ddd;
  padding: 10px 25px
}
.Order-price {
  display: flex;
  border-bottom: 1px solid #ddd;
}
.Order-price > * {
  padding: 10px 0;
}
.Order-price > *:first-child{
  flex: 1;
}
.Order-price:last-child {
  border-bottom: none;
}
.Order-price--sub {
  font-size: 1.2em;
  font-weight: 500;
}
.Order-price--tot {
  font-size: 1.4em;
  font-weight: 700;
}
/*
  Colors
*/
.color-lighter {
  color: #999;
}
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googlea.com/css2?family=Varela+Round&display=swap" rel="stylesheet">
<div class="Order">
  <div class="Order-price">
    <span class="color-lighter">Custom Tatoo Design - Small &times; 1</span>
    <span><s class="color-lighter">$99.00</s> <b>$80.00</b></span>
  </div>
  <div class="Order-price Order-price--sub">
    <span>Subtotal</span>
    <span>$80.00</span>
  </div>
  <div class="Order-price Order-price--tot">
    <span>Total</span>
    <span><small>USD</small> $80.00</span>
  </div>
</div>
-1

使用表边框很无聊,我的建议是在td/th元素中使用边框。

我创建了这个表没有风格,只解决边界问题

   .table-class {
    border: 1px solid #dddddd;
    border-radius: 6px;
    padding: 30px;
    border-spacing: unset;
    font-family: sans-serif;
    font-size: 1.5em;
}
.table-class thead th {
    border-bottom: 1px solid #dddddd;
    text-align: left;
}
.table-class tbody td {
    border-bottom: 1px solid #dddddd;
}
.table-class td:last-child, .table-class th:last-child {
    text-align: right;
}
.table-class th, .table-class td{
    padding: 10px;
}
<table class="table-class">
  <thead>
    <tr>
      <th>Custom Tattoo Desing - Small x 1</th>
      <th>
        <span><s>$99.00</s></span>
        <span>$80.00</span>
      </th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>Subtotal</td>
      <td>$80.00</td>
    </tr>
  </tbody>
  <tfoot>
    <tr>
      <td>Total</td>
      <td>USD $80.00</td>
    </tr>
  </tfoot>
</table>

本站系公益性非盈利分享网址,本文来自用户投稿,不代表码文网立场,如若转载,请注明出处

(111)
Python给多个变量赋值:赋值给常量变量(typeerror: assignment to constant variable
上一篇
Wps表格怎么换行:Google表格表格图表-换行文本
下一篇

相关推荐

  • css disabled属性禁用 HTML 元素

    CSS disabled属性是一个布尔值属性,用于指定元素是否处于禁用状态。当元素处于禁用状态时,它将不会接受任何用户输入,并且通常会以某种方式显示出来(例如,颜色变淡)。…

    2023-12-17 16:07:26
    0 55 85
  • css画一个圆:圆形的美丽

    使用css画一个圆,可以使用`border-radius`属性:上面的代码将会创建一个宽度和高度都是200px的圆形div。…

    2023-06-03 12:24:22
    0 29 88
  • css字间距怎么设置:标题

    示例示例CSS中字间距是指文本中每个字符之间的距离。可以使用CSS中的`letter-spacing`属性来设置字间距。代码示例:…

    2023-10-06 11:53:52
    0 32 53
  • css详细教程:CSS Tutorial

    CSS(Cascading Style Sheets)是用来控制网页的样式表。它可以让你改变文字的大小,颜色,字体,对齐方式,背景图片,布局等等。…

    2023-07-03 01:58:25
    0 91 16
  • html5和css3的新特性:Welcome to the Future of Web Design!

    示例示例HTML5新特性(新的语义元素…

    2023-05-20 12:24:46
    0 75 21
  • css 背景色 透明:Let Your True Colors Shine Through!

    示例示例CSS 背景色透明可以使用 rgba 函数来实现,其中 a 代表 alpha 通道,取值范围为 0-1,0 代表完全透明,代表完全不透明。示例代码:…

    2023-06-22 06:58:38
    0 59 24
  • html css引用:这是一个标题

    示例示例HTML CSS引用是指在HTML文件中通过标签引用CSS文件,使HTML文件能够使用CSS文件中的样式设置来控制其外观。代码示例:…

    2023-06-04 14:35:55
    0 50 16
  • css底部对齐:Welcome to Our Website

    示例示例css底部对齐指的是将多个元素的底部对齐,使用CSS实现底部对齐可以使用flex布局。代码示例:…

    2023-05-01 13:46:07
    0 53 62

发表评论

登录 后才能评论

评论列表(53条)