Canvas lineWidth property

Definition and usage

lineWidth Sets or returns the current line width in pixels.

Example

Draw a rectangle with a line width of 10 pixels:

Your browser does not support the canvas tag.

JavaScript:

var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.lineWidth=10;
ctx.strokeRect(20,20,80,100);

try it yourself

grammar

context.lineWidth=اعداد;

مقدار ویژگی

مقدار توضیح
اعداد پهنا فعلی خط، به پیکسل.

جزئیات فنی

مقدار پیش‌فرض: 1

پشتیبانی مرورگر

اعداد در جدول نشان‌دهنده نسخه اولین مرورگری است که این ویژگی را کامل پشتیبانی می‌کند.

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
4.0 9.0 3.6 4.0 10.1

نکته:Internet Explorer 8 و نسخه‌های قدیمی‌تر از <canvas> پشتیبانی نمی‌کنند.