image - 使用 css 或 canvas 制作表格

标签 image css canvas

我想知道是否可以使用 css 或 canvas 创建下面的图像?这似乎是可能的,但没有办法完成这样的壮举。

Fence-Over

感谢您花费的时间。

编辑{已解决}

在 friend @apaul34208的帮助下,可以做如下: http://jsfiddle.net/Igaojsfiddle/CcDG7/

#hexagon {
    width: 50px;
    height: 55px;
    background: red;
    position: relative;
}

#hexagon:after {
    content: "";
    position: absolute;
    bottom: -25px;
    left: 0;
    width: 0;
    height: 0;
    border-left: 25px solid transparent;
    border-right: 25px solid transparent;
    border-top: 25px solid red;
}

谢谢大家

最佳答案

您可以这样使用 Canvas :

Demo

enter image description here

HTML

<canvas id="demo" width=90 height=120></canvas>

JavaScript

var ctx = demo.getContext('2d'),  /// get canvas element
    w = demo.width,               /// cache dimensions
    h = demo.height,
    cw = w * 0.5;                 /// center hori.

ctx.beginPath();                  /// start path
ctx.moveTo(0, 0);                 /// plot shape
ctx.lineTo(w, 0);
ctx.lineTo(w, h - cw * 0.8);
ctx.lineTo(cw, h);
ctx.lineTo(0, h - cw * 0.8);
ctx.closePath()                   /// closes and ends last line
ctx.fillStyle ='#f55641';
ctx.fill();                       /// fill shape

关于image - 使用 css 或 canvas 制作表格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20461061/

相关文章:

java - 如何从文件夹中获取最后保存的项目的名称?

javascript - 如何使用 JavaScript 截取 Google Maps 的部分内容

html - 如何向占位符文本添加填充

javascript - drawImage() 未绘制预加载的图像对象。使用面向对象的javascript

javascript - Canvas Html5 Drawing App,移动 Canvas 导致大问题

image - 带有伪元素的响应式图像——这是个好主意吗?

image - 以编程方式 "smudge"图像的最佳方法是什么?

javascript - jquery - 拉伸(stretch)背景图像以填充文档而不是窗口?

html - 如何使元素水平滚动而不是垂直滚动

html - 流体表 : Truncate cell contents when needed, 否则保持表尽可能窄