Search completed in 1.31 seconds.
21 results for "textalign":
Your results are loading. Please wait...
CanvasRenderingContext2D.textAlign - Web APIs
"right" The text is right-aligned. "center" The text is centered. "start" The text is aligned at the normal start of the line (left-aligned for left-to-right locales, right-aligned for right-to-left locales). ...
... "right" The text is right-aligned. "center" The text is centered. "start" The text is aligned at the normal start of the line (left-aligned for left-to-right locales, right-aligned for right-to-left locales). ...
... "right" The text is right-aligned. "center" The text is centered. "start" The text is aligned at the normal start of the line (left-aligned for left-to-right locales, right-aligned for right-to-left locales). ...
...And 3 more matches
Cubic Bezier Generator - CSS: Cascading Style Sheets
nvas.getContext) { // use getContext to use the canvas for drawing var ctx = canvas.getContext('2d'); // Clear canvas ctx.clearRect(0, 0, canvas.width, canvas.height); // Draw the rulers ctx.beginPath(); ctx.strokeStyle = "black"; // Draw the Y axis ctx.moveTo(cX(0), cY(0)); ctx.lineTo(cX(1), cY(0)); ctx.textAlign = "right"; for (var i = 0.1; i <= 1; i = i + 0.1) { ctx.moveTo(-basic_scale_size + cX(0), lY(i)); if ((i == 0.5) || (i > 0.9)) { ctx.moveTo(-2 * basic_scale_size + cX(0), lY(i)); ctx.fillText(Math.round(i * 10) / 10, -3 * basic_scale_size + cX(0), cY(i) + 4); // Limitation the constant 4 should be font size dependant...
... ctx.fillText(Math.round(i * 10) / 10, -3 * basic_scale_size + cX(0), cY(i) + 4); // Limitation the constant 4 should be font size dependant } ctx.lineTo(cX(0), lY(i)); } ctx.stroke(); ctx.closePath(); ctx.beginPath(); // Draw the Y axis label ctx.save(); ctx.rotate(-Math.PI / 2); ctx.textAlign = "left"; ctx.fillText("Output (Value Ratio)", -cY(0), -3 * basic_scale_size + cX(0)); ctx.restore(); // Draw the X axis ctx.moveTo(cX(0), cY(0)); ctx.lineTo(cX(0), cY(1)); ctx.textAlign = "center"; for (i = 0.1; i <= 1; i = i + 0.1) { ctx.moveTo(lX(i), basic_scale_size + cY(0)); if ((i == 0.5) || (i > 0.9)) { ...
...+ cY(0)); if ((i == 0.5) || (i > 0.9)) { ctx.moveTo(lX(i), 2 * basic_scale_size + cY(0)); ctx.fillText(Math.round(i * 10) / 10, cX(i), 4 * basic_scale_size + cY(0)); // Limitation the constant 4 should be dependant of the font size } ctx.lineTo(lX(i), cY(0)); } // Draw the X axis label ctx.textAlign = "left"; ctx.fillText("Input (Time Duration Ratio)", cX(0), 4 * basic_scale_size + cY(0)); // Limitation the constant 4 should be dependant of the font size ctx.stroke(); ctx.closePath(); // Draw the Bezier Curve ctx.beginPath(); ctx.moveTo(cX(0), cY(0)); ctx.strokeStyle = 'blue'; ctx.bezierCurveTo(cX(x1), cY(y1), cX(x2), c...
Browser Feature Detection - Archive of obsolete content
argintop true true true marginright true true true marginbottom true true true marginleft true true true padding true true true paddingtop true true true paddingright true true true paddingbottom true true true paddingleft true true true textalign true true true textdecoration true true true textindent true true true texttransform true true true verticalalign true true true whitespace true true true width true true true wordspacing true true true DOM CSS 2 Support for properties/methods in document.
...arginTop', 'supported': false}, {name: 'marginRight', 'supported': false}, {name: 'marginBottom', 'supported': false}, {name: 'marginLeft', 'supported': false}, {name: 'padding', 'supported': false}, {name: 'paddingTop', 'supported': false}, {name: 'paddingRight', 'supported': false}, {name: 'paddingBottom', 'supported': false}, {name: 'paddingLeft', 'supported': false}, {name: 'textAlign', 'supported': false}, {name: 'textDecoration', 'supported': false}, {name: 'textIndent', 'supported': false}, {name: 'textTransform', 'supported': false}, {name: 'verticalAlign', 'supported': false}, {name: 'whiteSpace', 'supported': false}, {name: 'width', 'supported': false}, {name: 'wordSpacing', 'supported': false} ], 'DOMCSS2': [ {name: 'azimuth', 'supported': false}, ...
Canvas code snippets - Archive of obsolete content
ht instead be wrapped to be able to chain their child objects 'createImageData', 'createLinearGradient', 'createRadialGradient', 'getImageData', 'putImageData' ]; var props = ['canvas', 'fillStyle', 'font', 'globalAlpha', 'globalCompositeOperation', 'lineCap', 'lineJoin', 'lineWidth', 'miterLimit', 'shadowOffsetX', 'shadowOffsetY', 'shadowBlur', 'shadowColor', 'strokeStyle', 'textAlign', 'textBaseline']; for (let m of methods) { let method = m; Canvas2DContext.prototype[method] = function() { this.ctx[method].apply(this.ctx, arguments); return this; }; } for (let m of getterMethods) { let method = m; Canvas2DContext.prototype[method] = function() { return this.ctx[method].apply(this.ctx, arguments); }; } for (let p of props...
Documentation for BiDi Mozilla - Archive of obsolete content
r (in nsFrameTraversal.cpp) provides visual frame navigation capability. Details of rendering are dependent on user preferences and system capabilities. Where the system is capable of tasks such as reversing and shaping text, symmetric swapping, numeric translation, etc., no special text rendering is needed, though there may be a call to a native API to set the base text direction (for example SetTextAlign on Windows). For systems without Bidi capabilities, the methods in nsIUBidiUtils are used. Note that we are not affected by buggy Bidi implementations on specific platforms, since the platform never sees a text fragment with mixed directionality, and is not expected to do anything more complicated than displaying left-to-right text from left to right or right-to-left text from right to left. In ...
Manipulating documents - Learn web development
This is done with the HTMLElement.style property, which contains inline styling information for each element in the document. You can set properties of this object to directly update element styles. As an example, try adding these lines to our ongoing example: para.style.color = 'white'; para.style.backgroundColor = 'black'; para.style.padding = '10px'; para.style.width = '250px'; para.style.textAlign = 'center'; Reload the page and you'll see that the styles have been applied to the paragraph. If you look at that paragraph in your browser's Page Inspector/DOM inspector, you'll see that these lines are indeed adding inline styles to the document: <p style="color: white; background-color: black; padding: 10px; width: 250px; text-align: center;">We hope you enjoyed the ride.</p> Note: ...
CanvasRenderingContext2D.drawFocusIfNeeded() - Web APIs
on2, if appropriate drawButton(button2, 20, 80); if (ctx.isPointInPath(x, y)) { button2.focus(); } } function drawButton(el, x, y) { const active = document.activeElement === el; const width = 150; const height = 40; // Button background ctx.fillStyle = active ? 'pink' : 'lightgray'; ctx.fillRect(x, y, width, height); // Button text ctx.font = '15px sans-serif'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillStyle = active ? 'blue' : 'black'; ctx.fillText(el.textContent, x + width / 2, y + height / 2); // Define clickable area ctx.beginPath(); ctx.rect(x, y, width, height); // Draw focus ring, if appropriate ctx.drawFocusIfNeeded(el); } Result Specifications Specification Status Comment HTML Living Standa...
CanvasRenderingContext2D.fillText() - Web APIs
ional parameter allows specifying a maximum width for the rendered text, which the user agent will achieve by condensing the text or by using a lower font size. This method draws directly to the canvas without modifying the current path, so any subsequent fill() or stroke() calls will have no effect on it. The text is rendered using the font and text layout configuration as defined by the font, textAlign, textBaseline, and direction properties. To draw the outlines of the characters in a string, call the context's strokeText() method. Syntax CanvasRenderingContext2D.fillText(text, x, y [, maxWidth]); Parameters text A DOMString specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction. x Th...
CanvasRenderingContext2D.imageSmoothingEnabled - Web APIs
res three images. The first image is drawn at its natural size, the second is scaled to 3X and drawn with image smoothing enabled, and the third is scaled to 3X but drawn with image smoothing disabled. ...
CanvasRenderingContext2D.save() - Web APIs
e drawing state The drawing state that gets saved onto a stack consists of: The current transformation matrix. The current clipping region. The current dash list. The current values of the following attributes: strokeStyle, fillStyle, globalAlpha, lineWidth, lineCap, lineJoin, miterLimit, lineDashOffset, shadowOffsetX, shadowOffsetY, shadowBlur, shadowColor, globalCompositeOperation, font, textAlign, textBaseline, direction, imageSmoothingEnabled. Syntax void ctx.save(); Examples Saving the drawing state This example uses the save() method to save the default state and restore() to restore it later, so that you are able to draw a rect with the default state later. HTML <canvas id="canvas"></canvas> JavaScript const canvas = document.getElementById('canvas'); const ctx = canvas.get...
CanvasRenderingContext2D.strokeText() - Web APIs
t path, so any subsequent fill() or stroke() calls will have no effect on it. Use the fillText() method to fill the text characters rather than having just their outlines drawn. Syntax CanvasRenderingContext2D.strokeText(text, x, y [, maxWidth]); Parameters text A DOMString specifying the text string to render into the context. The text is rendered using the settings specified by font, textAlign, textBaseline, and direction. x The x-axis coordinate of the point at which to begin drawing the text. y The y-axis coordinate of the point at which to begin drawing the text. maxWidth Optional The maximum width the text may be once rendered. If not specified, there is no limit to the width of the text. However, if this value is provided, the user agent will adjust the kerning, select a mo...
CanvasRenderingContext2D - Web APIs
array containing an even number of non-negative numbers. CanvasRenderingContext2D.setLineDash() Sets the current line dash pattern. CanvasRenderingContext2D.lineDashOffset Specifies where to start a dash array on a line. Text styles The following properties control how text is laid out. CanvasRenderingContext2D.font Font setting. Default value 10px sans-serif. CanvasRenderingContext2D.textAlign Text alignment setting. Possible values: start (default), end, left, right, center. CanvasRenderingContext2D.textBaseline Baseline alignment setting. Possible values: top, hanging, middle, alphabetic (default), ideographic, bottom. CanvasRenderingContext2D.direction Directionality. Possible values: ltr, rtl, inherit (default). Fill and stroke styles Fill styling is used for colors and sty...
Drawing text - Web APIs
yling text In the examples above we are already making use of the font property to make the text a bit larger than the default size. There are some more properties which let you adjust the way the text gets displayed on the canvas: font = value The current text style being used when drawing text. This string uses the same syntax as the CSS font property. The default font is 10px sans-serif. textAlign = value Text alignment setting. Possible values: start, end, left, right or center. The default value is start. textBaseline = value Baseline alignment setting. Possible values: top, hanging, middle, alphabetic, ideographic, bottom. The default value is alphabetic. direction = value Directionality. Possible values: ltr, rtl, inherit. The default value is inherit. These properties might be ...
Transformations - Web APIs
urrent drawing state is pushed onto the stack. A drawing state consists of The transformations that have been applied (i.e. translate, rotate and scale - see below). The current values of the following attributes: strokeStyle, fillStyle, globalAlpha, lineWidth, lineCap, lineJoin, miterLimit, lineDashOffset, shadowOffsetX, shadowOffsetY, shadowBlur, shadowColor, globalCompositeOperation, font, textAlign, textBaseline, direction, imageSmoothingEnabled. The current clipping path, which we'll see in the next section. You can call the save() method as many times as you like. Each time the restore() method is called, the last saved state is popped off the stack and all saved settings are restored. A save and restore canvas state example This example tries to illustrate how the stack of drawing s...
Index - Web APIs
Web › API › Index
xt The CanvasRenderingContext2D method strokeText(), part of the Canvas 2D API, strokes -- that is, draws the outlines of -- the characters of a text string at the specified coordinates. An optional parameter allows specifying a maximum width for the rendered text, which the user agent will achieve by condensing the text or by using a lower font size. 607 CanvasRenderingContext2D.textAlign API, Canvas, CanvasRenderingContext2D, Property, Reference The CanvasRenderingContext2D.textAlign property of the Canvas 2D API specifies the current text alignment used when drawing text. 608 CanvasRenderingContext2D.textBaseline API, Canvas, CanvasRenderingContext2D, Property, Reference The CanvasRenderingContext2D.textBaseline property of the Canvas 2D API specif...
TextMetrics.actualBoundingBoxLeft - Web APIs
The read-only actualBoundingBoxLeft property of the TextMetrics interface is a double giving the distance parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign property to the left side of the bounding rectangle of the given text, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.actualBoundingBoxLeft; // 0; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.actualBoundingBoxLeft' in that specification. ...
TextMetrics.actualBoundingBoxRight - Web APIs
The read-only actualBoundingBoxRight property of the TextMetrics interface is a double giving the distance parallel to the baseline from the alignment point given by the CanvasRenderingContext2D.textAlign property to the right side of the bounding rectangle of the given text, in CSS pixels. Examples const canvas = document.createElement('canvas'); const ctx = canvas.getContext('2d'); const text = ctx.measureText('foo'); // returns TextMetrics object text.actualBoundingBoxRight; // 15.633333333333333; Specifications Specification HTML Living StandardThe definition of 'TextMetrics.actualBoundingBoxRight' in that specification. ...
TextMetrics - Web APIs
can be retrieved using the CanvasRenderingContext2D.measureText() method. Properties TextMetrics.width Read only Is a double giving the calculated width of a segment of inline text in CSS pixels. It takes into account the current font of the context. TextMetrics.actualBoundingBoxLeft Read only Is a double giving the distance from the alignment point given by the CanvasRenderingContext2D.textAlign property to the left side of the bounding rectangle of the given text, in CSS pixels. The distance is measured parallel to the baseline. TextMetrics.actualBoundingBoxRight Read only Is a double giving the distance from the alignment point given by the CanvasRenderingContext2D.textAlign property to the right side of the bounding rectangle of the given text, in CSS pixels. The distance is measur...
VTTCue - Web APIs
Web › API › VTTCue
be the string auto or a number representing the percentage of the VTTCue.region, or the video size if VTTCue.region is null. VTTCue.positionAlign Returns an enum representing the alignment of the cue. This is used to determine what the VTTCue.position is anchored to. The default is auto. VTTCue.size Returns a double representing the size of the cue, as a percentage of the video size. VTTCue.textAlign Returns an enum representing the alignment of all the lines of text within the cue box. VTTCue.text Returns a DOMString with the contents of the cue. Methods getCueAsHTML() Returns the cue text as a DocumentFragment. Example HTML <video controls src="https://udn.realityripple.com/samples/c6/f8a3489533.webm"></video> CSS video { width: 320px; height: 180px; } JavaScript let vi...
Window.devicePixelRatio - Web APIs
ccount for extra pixel density). var scale = window.devicePixelRatio; // Change to 1 on retina screens to see blurry canvas. canvas.width = Math.floor(size * scale); canvas.height = Math.floor(size * scale); // Normalize coordinate system to use css pixels. ctx.scale(scale, scale); ctx.fillStyle = "#bada55"; ctx.fillRect(10, 10, 300, 300); ctx.fillStyle = "#ffffff"; ctx.font = '18px Arial'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; var x = size / 2; var y = size / 2; var textString = "I love MDN"; ctx.fillText(textString, x, y); Monitoring screen resolution or zoom level changes In this example, we'll set up a media query and watch it to see when the device resolution changes, so that we can check the value of devicePixelRatio to handle any updates we need to. JavaScript The ...
CSS Properties Reference - CSS: Cascading Style Sheets
paddingBottom padding-left paddingLeft padding-right paddingRight padding-top paddingTop page-break-after pageBreakAfter page-break-before pageBreakBefore position position stroke-dasharray strokeDasharray stroke-dashoffset strokeDashoffset stroke-width strokeWidth text-align textAlign text-decoration textDecoration text-indent textIndent text-transform textTransform top top vertical-align verticalAlign visibility visibility width width z-index zIndex ...