-6
我有一個包含文本div元素,我想消滅整個元素,使兩線交叉爲標誌X.如何重拳出擊DIV
text-decoration:line-through
三振出局文本不適合。
我想要一個45度的線。我希望這可以藉助畫布。
我有一個包含文本div元素,我想消滅整個元素,使兩線交叉爲標誌X.如何重拳出擊DIV
text-decoration:line-through
三振出局文本不適合。
我想要一個45度的線。我希望這可以藉助畫布。
HTML:
<div id="con" style="position:relative;">
<canvas id="canvas" style="position:absolute; top:0; left:0; z-index:0;">
</canvas>
<div id="text">
.....
</div>
</div>
JS:
var width = document.getElementById('text').offsetWidth;
var height = document.getElementById('text').offsetHeight;
var canvas = document.getElementById('canvas');
canvas.width = width;
canvas.height = height;
var context = canvas.getContext('2d');
context.beginPath();
context.moveTo(0, 0);
context.lineTo(width, height);
context.moveTo(width, 0);
context.lineTo(0, height);
context.stroke();
您的問題可能已經回答[這裏](http://stackoverflow.com/questions/4619542/linethrough-strikethrough-a-whole -html-table-row) - 確保在提問之前進行搜索。 – Wez 2013-02-18 10:10:44
它不回答我的問題,有一條線穿過水平線,我想要一條45度線。我希望這可以在畫布 – Nar 2013-02-18 10:20:09
>的幫助下實現,我想要一個45度的線。我希望這可以藉助畫布 - >這根本不在你的問題中。 http://stackoverflow.com/faq#howtoask – 2013-02-18 10:21:50