css-initials
是一个 npm 包,它包含了 CSS 属性的初始值,可以方便开发者快速复制粘贴使用。
安装
你可以通过 npm 来安装 css-initials
:
npm install css-initials
使用
安装完成后,你可以通过以下方式使用这个库:
import cssInitials from 'css-initials'; console.log(cssInitials.backgroundColor); // 'transparent' console.log(cssInitials.color); // 'black'
你可以得到完整的属性列表:
accentColor, alignmentBaseline, backgroundColor, baselineShift, behavior, borderBottomColor, borderBottomStyle, borderBottomWidth, borderColor, borderImageOutset, borderImageRepeat, borderImageSlice, borderImageSource, borderImageWidth, borderLeftColor, borderLeftStyle, borderLeftWidth, borderRadius, borderRightColor, borderRightStyle, borderRightWidth, borderStyle, borderTopColor, borderTopStyle, borderTopWidth, borderWidth, bottom, boxDecorationBreak, boxShadow, boxSizing, breakAfter, breakBefore, breakInside, captionSide, clear, clip, clipPath, clipRule, color, colorInterpolationFilters, columnCount, columnFill, columnGap, columnRuleColor, columnRuleStyle, columnRuleWidth, columnSpan, columnWidth, content, counterIncrement, counterReset, cssFloat, cssText, cursor, direction, display, dominantBaseline, emptyCells, fill, fillOpacity, fillRule, filter, flexBasis, flexDirection, flexGrow, flexShrink, flexWrap, floodColor, floodOpacity, font, fontFamily, fontSize, fontStyle, fontWeight, glyphOrientationHorizontal, glyphOrientationVertical, height, imageRendering, imeMode, justifyContent, kerning, left, letterSpacing, lightingColor, lineHeight, listStyleImage, listStylePosition, listStyleType, margin, marginBottom, marginLeft, marginRight, marginTop, marker, markerEnd, markerMid, markerStart, mask, maxHeight, maxWidth, minHeight, minWidth, msContentZoomChaining, msContentZoomLimit, msContentZoomLimitMax, msContentZoomLimitMin, msContentZoomSnap, msContentZoomSnapPoints, msContentZoomSnapType, msContentZooming, msFlowFrom, msFlowInto, msFontFeatureSettings, msGridColumns, msGridRows, msHighContrastAdjust, msHyphenateLimitChars, msHyphenateLimitLines, msHyphenateLimitZone, msHyphens, msImeAlign, msOverflowStyle, msScrollChaining, msScrollLimit, msScrollLimitXMax, msScrollLimitXMin, msScrollLimitYMax, msScrollLimitYMin, msScrollRails, msScrollSnapPointsX, msScrollSnapPointsY, msScrollSnapType, msScrollSnapX, msScrollSnapY, msScrollTranslation, msScrollbar3dlightColor, msScrollbarArrowColor, msScrollbarBaseColor, msScrollbarDarkshadowColor, msScrollbarFaceColor, msScrollbarHighlightColor, msScrollbarShadowColor, msTextCombineHorizontal, msTextSizeAdjust, msTouchAction, msTouchSelect, msUserSelect, msWrapFlow, msWrapMargin, msWrapThrough, objectFit, objectPosition, opacity, order, orphans, outlineColor, outlineOffset, outlineStyle, outlineWidth, overflow, overflowWrap, overflowX, overflowY, padding, paddingBottom, paddingLeft, paddingRight, paddingTop, pageBreakAfter, pageBreakBefore, pageBreakInside, pointerEvents, position, quotes, resize, right, rubyAlign, rubyPosition, stopColor, stopOpacity, stroke, strokeDasharray, strokeDashoffset, strokeLinecap, strokeLinejoin, strokeMiterlimit, strokeOpacity, strokeWidth, tableLayout, textAlign, textDecorationColor, textDecorationLine, textDecorationStyle, textIndent, textJustify, textOverflow, textShadow, textTransform, textUnderlinePosition, top, touchAction, transform, transformOrigin, transformStyle, transition, transitionDelay, transitionDuration, transitionProperty, transitionTimingFunction, unicodeBidi, verticalAlign, visibility, whiteSpace, widows, width, wordBreak, wordSpacing, wordWrap, writingMode, zIndex
示例
下面展示如何使用 css-initials
来复制 CSS 样式表的初始值:
-- -------------------- ---- ------- ------ ----------- ---- --------------- ----- ------------ - --- -------------------------------------- -- - ----------------- - ----------------- --- ------------------------------------------ -- ------------- -------------------------------- -- -------
意义
css-initials
提供了一个方便的方式来获取 CSS 属性的初始值。如果你需要在开发 CSS 工具时快速重置属性,或者需要开发自定义的 CSS 指南或文档,那么使用 css-initials
是一个不错的选择。
来源:JavaScript中文网 ,转载请注明来源 https://www.javascriptcn.com/post/59080