css 日历 - td 背景对角分割 - 两种颜色

2024-01-28

我在 jsfiddle 找到了一个 css 风格的日历,并想添加一些特定的 td 背景,例如这里的对角线分割jsfiddle http://jsfiddle.net/Tw5Wa/.

但组合起来却显得非常扭曲jsfiddle http://jsfiddle.net/9pS3L/.

HTML:

  <table>
  <thead>
  <tr>
      <th colspan="8">
          Oktober 2011
      </th>
  </tr>
  </thead>
  <tbody>
  <tr>
      <th class="cw">KW</th>
      <th>Mo</th>
      <th>Di</th>
      <th>Mi</th>
      <th>Do</th>
      <th>Fr</th>
      <th>Sa</th>
      <th>So</th>
  </tr>
  <tr>
      <td class="cw">39</td>
      <td class="off">26</td>
      <td class="off">27</td>
      <td class="off">28</td>
      <td class="off">29</td>
      <td class="off">30</td>
      <td class="free">1</td>
      <td class="free">2</td>
  </tr>
  <tr>
      <td class="cw">40</td>
      <td class="free">3</td>
      <td class="free">4</td>
      <td class="free">5</td>
      <td class="free">6</td>
      <td class="free">7</td>
      <td class="booked_pm">8</td>
      <td class="booked">9</td>
  </tr>
  <tr>
      <td class="cw">41</td>
      <td class="booked">10</td>
      <td class="booked">11</td>
      <td class="booked">12</td>
      <td class="booked">13</td>
      <td class="booked">14</td>
      <td class="booked_am">15</td>
      <td class="free">16</td>
  </tr>
  <tr>
      <td class="cw">42</td>
      <td class="free">17</td>
      <td class="free">18</td>
      <td class="free">19</td>
      <td class="free">20</td>
      <td class="free">21</td>
      <td class="free">22</td>
      <td class="free">23</td>
  </tr>
  <tr>
      <td class="cw">43</td>
      <td class="free">24</td>
      <td class="free">25</td>
      <td class="free">26</td>
      <td class="free">27</td>
      <td class="free">28</td>
      <td class="free">29</td>
      <td class="free">30</td>
  </tr>
  <tr>
      <td class="cw">44</td>
      <td class="free">31</td>
      <td class="off">1</td>
      <td class="off">2</td>
      <td class="off">3</td>
      <td class="off">4</td>
      <td class="off">5</td>
      <td class="off">6</td>
  </tr>
  </tbody>

CSS:

body {
background-color: #f4f4f4; }

table {
-webkit-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.3);
-moz-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.3);
-ms-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.3);
-o-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.3);
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.3);
border-spacing: 0;
font-family: 'Helvetica Neue';
width: 239px; }

table thead th {
-webkit-border-radius: 1px;
-moz-border-radius: 1px;
-ms-border-radius: 1px;
-o-border-radius: 1px;
border-radius: 1px;
-webkit-box-shadow: inset 0 1px 0 0 #e88486;
-moz-box-shadow: inset 0 1px 0 0 #e88486;
-ms-box-shadow: inset 0 1px 0 0 #e88486;
-o-box-shadow: inset 0 1px 0 0 #e88486;
box-shadow: inset 0 1px 0 0 #e88486;
background-color: #e56568;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #e56568), color-stop(100%, #bd3f41));
background-image: -webkit-linear-gradient(top, #e56568, #bd3f41);
background-image: -moz-linear-gradient(top, #e56568, #bd3f41);
background-image: -ms-linear-gradient(top, #e56568, #bd3f41);
background-image: -o-linear-gradient(top, #e56568, #bd3f41);
background-image: linear-gradient(top, #e56568, #bd3f41);
border: 1px solid #ac2826;
color: white;
font-size: 13pt;
font-weight: 400;
padding: 8px 0;
text-align: center;
text-shadow: 0 -1px 1px rgba(0, 0, 0, 0.3); }

table tbody th {
-webkit-box-shadow: inset 0 1px 0 0 white;
-moz-box-shadow: inset 0 1px 0 0 white;
-ms-box-shadow: inset 0 1px 0 0 white;
-o-box-shadow: inset 0 1px 0 0 white;
box-shadow: inset 0 1px 0 0 white;
background-color: #f5f5f5;
background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f5f5f5), color-stop(100%, #e8e8e8));
background-image: -webkit-linear-gradient(top, #f5f5f5, #e8e8e8);
background-image: -moz-linear-gradient(top, #f5f5f5, #e8e8e8);
background-image: -ms-linear-gradient(top, #f5f5f5, #e8e8e8);
background-image: -o-linear-gradient(top, #f5f5f5, #e8e8e8);
background-image: linear-gradient(top, #f5f5f5, #e8e8e8);
border-bottom: 1px solid #d4d4d4;
color: #666666;
font-size: 7.5pt;
font-weight: normal;
padding: 4px 0;
text-align: center;
text-shadow: 0 1px 0 #ffffff;
text-transform: uppercase;
width: 34px; }

table tbody th:first-child {
border-left: 1px solid #abb6bf; }
table tbody th:last-child {
border-right: 1px solid #abb6bf; }
table tbody td {
background-color: #fcfdfd;
border-bottom: 1px solid #e2e2e2;
border-left: 1px solid #e2e2e2;
color: #444444;
font-size: 11pt;
font-weight: bold;
height: 27px;
padding: 0;
text-align: center;
width: 34px; }
table tbody td.off {
color: #9ea2a7; }
table tbody td:last-child {
border-right: 1px solid #abb6bf; }
table tbody td:first-child {
border-left: 1px solid #abb6bf; }
table tbody td:not(:last-child) {
-webkit-box-shadow: inset -1px 0 0 0 #eeefef;
-moz-box-shadow: inset -1px 0 0 0 #eeefef;
-ms-box-shadow: inset -1px 0 0 0 #eeefef;
-o-box-shadow: inset -1px 0 0 0 #eeefef;
box-shadow: inset -1px 0 0 0 #eeefef; }

table tbody th.cw {
border-bottom: none; }

table tbody td.cw {
background-color: #e8e8e8;
border-bottom: none;
color: #666666;
font-size: 7.5pt;
font-weight: normal;
text-align: center;
text-shadow: 0 1px 0 #ffffff;
text-transform: uppercase; }

table tbody td.free {
background-color: #007700;
color: #fff; }

table tbody td.booked {
background-color: #c43c35;
color: #fff; }

table tbody td.booked_am, table tbody td.booked_pm {
height: 27px !important;
display: inline-block;
background: transparent; }

table tbody td.booked_am {
line-height: 0%;
width: 0px;
background-color:#007700;
border-top: 27px solid transparent;
border-right: 32px solid #c43c35;
color: #fff; }

table tbody td.booked_pm {
line-height: 0%;
width: 0px;
background-color:#007700;
border-top: 27px solid #c43c35;
border-right: 32px solid transparent;
color: #fff; }

也许你们中的某个人可以提供帮助。

Thx


由于您似乎正在使用 CSS3,我已经使用 CSS3 渐变更新了您的小提琴:http://jsfiddle.net/9pS3L/1/ http://jsfiddle.net/9pS3L/1/这似乎就是您想要实现的目标。 您应该用您自己的颜色更新它。这是一个很好的渐变工具:http://www.colorzilla.com/gradient-editor/ http://www.colorzilla.com/gradient-editor/甚至应该与 IE 兼容,但会产生水平渐变(虽然还没有尝试过......)

您还可以使用 SASS 和 compass,这些都是制作 CSS3 的好工具。

尝试用边框实现您想要实现的目标是很棘手的,因为这不是边框最初构建的目的。

仅举个例子,webkit 代码:

div{
    width:20px;
    height:20px;
    background: -webkit-gradient(linear, left top, right bottom, color-stop(50%,red), color-stop(50%,green));
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

css 日历 - td 背景对角分割 - 两种颜色 的相关文章

  • 使用渐变获取颜色条中特定位置的颜色值

    我生成了一个带有 CSS3 样式的渐变颜色条 fiddle http jsfiddle net eDEWk 现在想要该颜色条中特定位置的颜色值 通过 x 和 y 坐标 据我所知 没有直接的方法可以做到这一点 我看到两个选择 在 JavaSc
  • 不加载隐藏图像

    我的网站上有一堆隐藏图像 它们的容器 DIV 具有 style display none 根据用户的操作 某些图像可能会通过 JavaScript 显示 问题是我的所有图像都是在打开页面时加载的 我想通过仅加载最终可见的图像来减轻服务器的压
  • Safari 中透明颜色会发生什么情况?

    有一个块 其中接近末尾的文本逐渐消失 这是使用以下方法完成的 after 给定linear gradient从透明色到背景色 最近注意到 在当前版本的浏览器中 除了 safari 之外 一切都很好 在第 11 版中 情况太糟糕了 Autop
  • 使用 CSS 让图像位于文本后面并使其保持在中心位置

    我正在创建一个网页 其中有一个要放置在中心的图像 在该图像的顶部 我想要有输入框 标签和提交按钮 我正在尝试使用这个CSS img center z index 1 但这不起作用 当我将代码更改为 img center position a
  • 使用 javascript 将 CSS 类添加到具有另一个类名的所有元素

    我正在尝试使用 javascript 将类添加到具有不同类的所有元素 我知道你可能认为这是多余的 但对于我所处的情况来说这是必要的 我需要一种方法来查看具有该类名称的所有元素并添加该类 但我不明白如何获取计数 我正在使用一个 cms 但我无
  • CSS/html - 使页脚仅在滚动后可见?坚持到可见页面区域下方的底部吗?

    好的 我已经完全按照这个链接进行操作 并试图实现稍微改变的效果 https css tricks com snippets css sticky footer https css tricks com snippets css sticky
  • http://jigsaw.w3.org/css-validator/ 和 http://www.css-validator.org/ CSS 验证器之间的区别?

    我尝试使用两个验证器验证我的 CSS 但它们给出了不同的结果 http www css validator org http www css validator org 返回的错误 在我的例子中为 245 比http jigsaw w3 o
  • Bootstrap 4 列和行产生不需要的填充[重复]

    这个问题在这里已经有答案了 我正在尝试使用 bootstrap 创建列和行来放置我的图像 但是在图像周围添加了太多的填充 这导致我的图像看起来不像设计 这就是我构建 HTML 的方式
  • 如何使用 Materialise CSS 将文本输入居中?

    我试图使用 Materialise CSS 将输入文本居中 但 center 和 center align 类似乎没有效果 我不知道我在这里错过了什么 div class section div class row center align
  • 覆盖 Bootstrap 表格边框折叠样式

    引导程序有一个table border collapse collapse border spacing 0 风格 我想覆盖它 所以我创建了一个类并将其应用到有问题的表 table FormGroupContainer border col
  • 解析器阻塞与渲染阻塞

    我一直在阅读有关优化网络性能的 Google 开发人员文档 我对那里使用的术语有点困惑 CSS 和 JavaScript 文件都会阻止 DOM 构建 但是 CSS 被称为渲染阻塞 而 JavaScript 被称为解析器阻塞 解析器阻塞 和
  • 用左div填充剩余空间

    谁能告诉我如何让左侧 div 填充剩余空间 而不固定右侧 div 大小 我想要与以下示例完全相反的内容 left float left border 1px solid blue right overflow hidden border 1
  • 如何为文本添加发光效果?

    我还没有真正找到任何好的简单的动画发光效果教程 如何为文本设置发光动画 如果您只想使用 CSS3 您甚至不必使用任何 jQuery JavaScript 只需在 CSS 中执行以下操作 confirm selection webkit tr
  • 在我的输入中显示多个信息

    我有一个输入 div class search field search field date search field calendar ui datepicker calendar columns small 3 div
  • 移动时如何将图像保留在另一图像后面?

    Edit Here https jsfiddle net 33cL1qos 6 我可以在选择时将其保留在后面 但由于某种原因它现在不可拖动 我可能做错了什么 我能够从计算机上传图像 然后移动图像 我的问题 当我选择图像时 它会向前弹出 直到
  • window.alert() 之后无法编辑输入文本字段

    我有这个 Electron 应用程序 使用 NodeJS Bootstrap AngularJS 其中包含一些可以编辑的文本输入字段 我有一个触发 window alert 的按钮 触发后 文本输入字段将不再可编辑 单击应用程序的其他元素不
  • Angular4 Material md-table 列宽度像普通表一样自动调整大小

    我在 Angular 4 应用程序中使用 md table 因为我将 Material 用于 UI 格式的其他部分 当我使用基本上没有 CSS 的常规表格时 列会自动设置格式以适合最宽的 td 元素 使用 md table 除了太宽的单元格
  • Android 设备中未显示背景图片?

    我将以下代码添加到main xml将图像设置为我的应用程序的背景图像 android background drawable bg So main xml看起来像这样
  • BigVideo.js 播放结束时 URL 重定向

    我已经使用基于 Video js 的 BigVideo 在页面上实现了背景视频 单击 div 时 视频会在后台播放 我一生都无法弄清楚如何在视频播放完毕后重定向到另一个 URL 这是我正在使用的代码 视频播放链接 a href vids g
  • 我们可以在displaytag中使用rowspan和colspan吗?

    我必须创建一个表 其结构是这样的 col1 col2 col3 col4 col3 1 col3 2 是否可以使用显示标签创建这样的数据网格 查看装饰器示例 http displaytag sourceforge net 1 2 tut d

随机推荐