imgrender

Styles

Control element appearance with inline CSS

imgrender currently supports only inline CSS to control styles:

imgrender does not yet support using Style Sheets to manage styles

Inline CSS

Set inline styles with the style attribute. Property names use standard CSS hyphenated form (such as font-size). Use : between a property and its value, and separate multiple properties with ;.

<div style="color: red; font-size: 20px">Hello imgrender</div>

Supported styles

The table below lists supported style properties, values, and limitations.

PropertyExpanded propertiesSupported valuesLimitations
displaynone, flex, inline-flex, grid, inline-grid, block, inline-block, inline, flow-root, list-item, table, table-row, table-cell, table-header-group, table-row-group, table-footer-group, table-caption. Tables support fixed column widths, captions, and row-group orderingColumn widths and caption spacing may differ from browsers
positionstatic, relative, absolute, fixed. static does not apply positioning offsets. fixed is positioned relative to the canvas—
directionltr, rtl. Inheritance, child overrides, and start-edge text alignment are supported—
floatleft, right, none—
clearleft, bothnone and right may still place the element below a taller float
z-indexSupported—
widthLengths, auto, fit-content, stretch. block supports percentagesA percentage width on inline-block may paint the background too narrow. Widths from min-content and max-content may not match the content size. Use an explicit length
heightLengths, percentages, auto, min-content, max-content, fit-content, stretch—
max-widthLengths, percentages, auto, none. Neither auto nor none sets an upper limitDoes not support min-content, max-content, fit-content, or stretch
max-heightLengths, percentages, auto, none. Neither auto nor none sets an upper limitDoes not support min-content, max-content, fit-content, or stretch
min-widthLengths, percentages, autoDoes not support min-content, max-content, fit-content, or stretch
min-heightLengths, percentages, autoDoes not support min-content, max-content, fit-content, or stretch
aspect-ratioA ratio used to compute an automatic width or heightWhen both width and height are specified, the ratio may override the explicit height
containnone, style, layout, paint, and non-repeating combinations. content is equivalent to layout style paint. layout establishes a containing block for absolute positioning. paint clips overflowDoes not support size, inline-size, or strict
animationanimation-nameSupported—
animation-durationSupported—
animation-delaySupported—
animation-timing-functionlinear, ease, ease-in, ease-out, ease-in-out, step-start, step-end, steps(), cubic-bezier()—
animation-iteration-countSupported—
animation-directionSupported—
animation-fill-modeSupported—
animation-play-stateSupported—
paddingpadding-top, padding-right, padding-bottom, padding-left, padding-inline, padding-inline-start, padding-inline-end, padding-blockSupported—
marginmargin-top, margin-right, margin-bottom, margin-left, margin-inline, margin-inline-start, margin-inline-end, margin-blockSupported—
insettop, right, bottom, left, inset-inline, inset-blockSupportedUnder RTL, inset-inline does not swap the left and right edges. Use left and right
borderborder-width (border-top-width, border-right-width, border-bottom-width, border-left-width, border-inline-width, border-block-width)Lengths (including 0)A visible border may make the outer box size differ from what you expect. Set box-sizing explicitly. Under RTL, border-inline-width does not swap the left and right edges. Use border-left-width and border-right-width. When an empty element is not painted, remove the indented white space inside it
border-stylenone, hidden, solid, dashed, dotted, double, groove, ridge, inset, outset. none does not paint a border—
border-colorSupported—
border-radiusborder-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radiusSupported—
border-top, border-right, border-bottom, border-leftA combination of width, style, and color for a single sideSet box-sizing explicitly to determine the outer box size
border-top-style, border-right-style, border-bottom-style, border-left-stylenone, hidden, solid, dashed, dotted, double, groove, ridge, inset, outset—
border-top-color, border-right-color, border-bottom-color, border-left-colorColor values (including transparent)—
corner-shapecorner-top-left-shape, corner-top-right-shape, corner-bottom-left-shape, corner-bottom-right-shaperound, squircle, bevel, scoop, notch, square, superellipse(2), superellipse(0)Must be used with border-radius
outlineoutline-widthSupported—
outline-stylenone, hidden, solid, dashed, dotted, double, groove, ridge, inset, outset. Neither hidden nor none paints an outline—
outline-colorSupported—
outline-offsetSupported—
flexflex-basisLengths, percentages, content, auto, min-content, max-content, fit-content, stretch—
flex-growSupported—
flex-shrinkSupported—
orderSupported—
Flexboxflex-directionrow, row-reverse, column, column-reverse—
flex-flowSupported—
flex-line-count1, 2, 3Use with flex-wrap: balance to set the minimum number of lines
-webkit-box-orienthorizontal, vertical. These correspond to flex-direction: row and column respectively—
-webkit-box-packstart, end, center, justify. These correspond to the justify-content values flex-start, flex-end, center, and space-between respectively—
-webkit-box-alignstart, end, center, baseline, stretch. These correspond to the align-items values flex-start, flex-end, center, baseline, and stretch respectively—
justify-contentnormal, stretch, start, end, flex-start, flex-end, center, space-between, space-around, space-evenly. safe and unsafe are supportedsafe does not support normal, stretch, or space-distribution values. On overflow, safe falls back to the start side, and unsafe keeps the specified alignment
justify-selfGrid layout: normal, baseline, stretch, start, end, flex-start, flex-end, self-start, self-end, center. safe and unsafe are supportedsafe does not support normal, baseline, or stretch. On overflow, safe falls back to the start side, and unsafe keeps the specified alignment. auto is not supported
align-contentnormal, stretch, start, end, flex-start, flex-end, center, space-between, space-around, space-evenly. safe and unsafe are supportedsafe does not support normal, stretch, or space-distribution values. On overflow, safe falls back to the start side, and unsafe keeps the specified alignment
place-contentcenter center—
justify-itemsGrid layout: normal, baseline, stretch, start, end, flex-start, flex-end, self-start, self-end, center. safe and unsafe are supportedsafe does not support normal, baseline, or stretch. On overflow, safe falls back to the start side, and unsafe keeps the specified alignment
align-itemsGrid layout: normal, baseline, stretch, start, end, flex-start, flex-end, self-start, self-end, center. safe and unsafe are supportedsafe does not support normal, baseline, or stretch. On overflow, safe falls back to the start side, and unsafe keeps the specified alignment
place-itemsGrid layout: center—
align-selfGrid layout: normal, baseline, stretch, start, end, flex-start, flex-end, self-start, self-end, center. safe and unsafe are supportedsafe does not support normal, baseline, or stretch. On overflow, safe falls back to the start side, and unsafe keeps the specified alignment. auto is not supported
place-selfGrid layout: end—
flex-wrapnowrap, wrap, wrap-reverse, balance, wrap balance, balance wrap, wrap-reverse balance, balance wrap-reverse. balance can be combined with flex-line-count. Reversed combinations swap the direction in which lines are arranged—
gap (column-gap, row-gap)Supported—
object-fitcontain, cover, fill, none, scale-down—
object-positioncenter, left top, right bottom, 50% 50%—
caption-sidetop, bottom. The caption is placed above or below the tableSpacing may differ from browsers
border-collapseseparate, collapse. Adjacent borders are shown separately or merged, respectively—
border-spacingOne length or two lengths. Two values set the horizontal and vertical spacing respectively—
table-layoutauto, fixedColumn widths and caption spacing may differ from browsers
overflowoverflow-x, overflow-yvisible, clip, hidden. clip and visible can clip on independent axesA per-axis combination of hidden and visible may clip both axes
backgroundColor valuesCombining color, image, position, size, and repeat may show only the background color. Use the longhand properties below separately
Background longhand propertiesbackground-imagelinear-gradient(), radial-gradient(), conic-gradient(), repeating-linear-gradient(), repeating-radial-gradient(), repeating-conic-gradient(), url()—
background-positionleft top, center, right bottom—
background-originborder-box, padding-box, content-box. Controls the positioning origin of the background image—
background-sizecontain, cover, auto. Explicit width and height are supported, such as 100px 50px—
background-repeatno-repeat, repeat, repeat-x, repeat-y—
background-colorSupported—
background-clipcontent-box, padding-box, border-box, text. text, together with a transparent text fill, shows the background inside the glyphsThe clipping region is affected by padding, borders, and the box model. Set box-sizing explicitly. When an empty element is not painted, remove the indented white space inside it
background-blend-modenormal, multiply, screen—
box-shadowSupported—
Clipclip-pathcircle(), inset(), polygon(), noneDoes not support ellipse(50px 30px at center)
clip-ruleevenodd, nonzero. Applies to polygon() in HTML. The two values can leave a hole or fill the center, respectively. You can also use polygon(evenodd, ...) to set the shape's own rule—
masklinear-gradient(to right, transparent, #000)The shorthand that combines image, position, size, and repeat has no effect. Use the longhand properties below. When an empty element is not painted, remove the indented white space inside it
Mask longhand propertiesmask-imageurl(), linear-gradient(), none. Use with mask-position, mask-size, and mask-repeat to set an image maskWhen an empty element is not painted, remove the indented white space inside it
mask-sizeExplicit width and height are supported, such as 100px 50px—
mask-positionleft top, center, right bottom—
mask-repeatno-repeat, repeat, repeat-x, repeat-y—
transformtranslate(), translateX(), translateY(), rotate(), scale(), scaleX(), scaleY(), matrix(), skewX(), skewY(), none. Function combinations are supported, and order affects the resultOnly 2D transforms are supported. When an empty element is not painted, remove the indented white space inside it
Individual 2D transform propertiestranslate2D translation, such as 40px 20pxtranslate-x and translate-y are not supported. Use translateX() and translateY() on transform. When an empty element is not painted, remove the indented white space inside it
rotate2D rotation is supported, such as 90degWhen an empty element is not painted, remove the indented white space inside it
scale2D scaling, such as 1.5 0.5scale-x and scale-y are not supported. Use scaleX() and scaleY() on transform. When an empty element is not painted, remove the indented white space inside it
transform-origincenter, 0 0, 100% 100%—
offsetpath("M 0 0 L 200 0") 50% 0deg, path("M 0 0 L 200 0") 50px auto—
offset-pathStraight-line path(), and circle(), ellipse(), and polygon() with an explicit centerPositions for ray(), inset(), border-box, and content-box may not match expectations. url() is not supported
offset-distanceLengths and percentages. Percentages are relative to the path length—
offset-rotateauto, reverse, 0deg, 90deg, auto 30deg—
offset-anchorauto, 0 0, 100% 100%Does not support center
offset-positionnormal, auto, 0 0, 50% 50%—
Gridgrid-auto-columnsLengths are supported, such as 80px—
grid-auto-rowsLengths are supported, such as 30px—
grid-auto-flowrow, column, row dense—
grid-column (grid-column-start, grid-column-end)Numeric grid-line start and end are supported, such as 2 / 4. Spans are supported, such as 2 / span 2—
grid-row (grid-row-start, grid-row-end)Numeric grid-line start and end are supported, such as 1 / 3—
grid-area (grid-row-start, grid-column-start, grid-row-end, grid-column-end)Numeric grid-line form is supported, such as 1 / 2 / 3 / 4Named areas are not supported
grid-template-columnsCombinations of lengths, fr, repeat(), and minmax()—
grid-template-rowsLength lists and repeat()—
list-stylesquare inside, decimal outsideA shorthand that includes an image may have no effect. Use list-style-image
list-style-typenone, decimal, decimal-leading-zero, lower-alpha, lower-latin, upper-alpha, upper-latin, lower-roman, upper-roman, and the string "X"disc, circle, and square differ in marker size or first-line occupancy
list-style-positioninside, outside. These respectively include the marker in the first line's occupied space or place it outside the content area—
list-style-imageurl() image markers and none. none removes the image and restores the type marker—
Typographytext-overflowellipsis, clipCustom strings are not supported and are treated as clip
text-transformnone, uppercase, lowercase, capitalize—
font-styleSupported—
colorSupported—
text-shadowSupported—
font-sizeSupported—
font-familyFont fallback is supported—
line-heightLengths and unitless multipliers are supported. Line spacing after wrapping is supported. For example, a 24px font size with 1.5 yields 36px of line spacing—
vertical-alignbaseline, top, bottom, middle, and length offsets—
font-weightSupported—
font-stretchSupported—
font-variation-settingsSupported—
font-feature-settingsSupported—
font-variantnormal, none, small-capsThe font must provide the corresponding OpenType features. Missing features are not synthesized
font-variant-ligaturesnormal, none, common-ligatures, no-common-ligatures, discretionary-ligaturesThe font must provide the corresponding OpenType features. Missing features are not synthesized
font-variant-numericnormal, oldstyle-nums, proportional-nums, diagonal-fractions, ordinal, slashed-zeroThe font must provide the corresponding OpenType features. Missing features are not synthesized
font-variant-east-asiannormal, jis83, jis90, full-width, proportional-widthThe font must provide the corresponding OpenType features. Missing features are not synthesized
font-variant-capsnormal, small-caps, all-small-caps, petite-caps, all-petite-capsThe font must provide the corresponding OpenType features. Missing features are not synthesized
font-variant-positionnormal, sub, superThe font must provide the corresponding OpenType features. Missing features are not synthesized
font-kerningauto, normal, noneThe font must provide the corresponding OpenType features. Missing features are not synthesized
font-synthesisnone, weight, styleDoes not support small-caps
font-synthesis-weightauto, none—
font-synthesis-styleauto, none—
line-clampA numberA custom truncation marker is treated as an ordinary ellipsis. Use block-ellipsis to set a custom marker
max-linesnone, 1, 2, 3Use with continue: collapse to limit the number of lines
block-ellipsisnone (no marker), auto (ellipsis), "END" (displays END)Use with max-lines and continue: collapse
continuenormal, collapse. These keep the following content or truncate at max-lines, respectively—
text-alignleft, right, center, start, end, justify—
text-indentLengths and percentages (including negative values). Only the first line is indented—
tab-size0, 2, 4, 8When tab characters are preserved, each tab expands to the corresponding number of spaces. This differs from how browsers align to tab stops
text-fitnone, grow, shrink. For single-line text, these respectively keep the original font size, enlarge short text, or shrink overflowing long text to fit the container—
letter-spacingSupported—
word-spacingSupported—
overflow-wrapnormal, break-word, anywhere—
word-breaknormal, break-all, keep-all, break-word—
white-spacenormal, nowrap, pre, pre-wrap, pre-line, <text-wrap-mode> <white-space-collapse>. nowrap prevents soft wrapping, collapses consecutive white space, and preserves explicit br line breaks—
white-space-collapsepreserve, collapse, preserve-spaces, preserve-breaks—
text-wraptext-wrap-modewrap, nowrap—
text-wrap-styleauto, balance, pretty—
box-sizingcontent-box, border-box—
opacitySupported—
image-renderingauto, smooth, pixelated—
filterblur(), brightness(), grayscale(), hue-rotate(), invert(), opacity(), saturate(), sepia(), drop-shadow(), none. Function combinations are supportedDoes not support contrast() or url() (including local fragments and external SVG)
backdrop-filterblur(), brightness(), contrast(), grayscale(), hue-rotate(), invert(), opacity(), saturate(), sepia(), drop-shadow(), none, and function combinations. Applies to content behind the covered areaDoes not support url() (including local fragments and external SVG)
-webkit-text-stroke-webkit-text-stroke-width, -webkit-text-stroke-color, -webkit-text-fill-colorSupported—
stroke-linejoinmiter, round, bevel—
text-decorationtext-decoration-lineunderline, line-through, overline, underline overlineAn overline needs enough line height to avoid being clipped. For a 48px font size, use line-height: 72px
text-decoration-stylesolid, double, dotted, dashed, wavyA double line needs enough line height. For a 48px font size, use line-height: 72px, and set text-decoration-thickness explicitly
text-decoration-colorSupported—
text-decoration-thicknessSupported—
text-decoration-skip-inkauto, none—
text-underline-offsetauto, 0, 8px, 20%. Percentages are relative to the font size—
text-underline-positionauto, from-font, under—
isolationauto, isolate—
mix-blend-modenormal, multiply, screen, darken, lighten, overlay, color-dodge, color-burn, hard-light, soft-light, difference, exclusion, hue, saturation, color, luminosity—
visibilityvisible, hidden—

On this page