CSS color Property |Online Tutorial
\n\nOnline Tutorial -- Learn not only technology, but also dreams!
\n\n- \n
- Home \n
- HTML \n
- JavaScript \n
- CSS \n
- Vue \n
- React \n
- Python3 \n
- Java \n
- C \n
- C++ \n
- C# \n
- AI \n
- Go \n
- SQL \n
- Linux \n
- VS Code \n
- Bootstrap \n
- Git \n
- Local Bookmarks \n
- \n
- Bootstrap3 \n
- Bootstrap4 \n
- Bootstrap5 \n
- \n
- Machine Learning \n
- PyTorch \n
- TensorFlow \n
- Sklearn \n
- NLP \n
- AI Agent \n
- Ollama \n
- Coding Plan \n
CSS Reference Manual
\n\nCSS Reference ManualCSS SelectorsCSS Aural Reference ManualCSS Web Safe FontsCSS AnimationCSS FunctionsCSS UnitsCSS ColorsCSS Legal Color ValuesCSS Color NamesCSS Color Hexadecimal ValuesCSS Browser SupportSass Tutorial
\n\nCSS Properties
\n\nalign-contentalign-itemsalign-selfallanimationanimation-delayanimation-directionanimation-durationanimation-fill-modeanimation-iteration-countanimation-nameanimation-play-stateanimation-timing-functionappearancebackface-visibilitybackgroundbackground-attachmentbackground-blend-modebackground-clipbackground-colorbackground-imagebackground-originbackground-positionbackground-repeatbackground-sizeborderborder-bottomborder-bottom-colorborder-bottom-left-radiusborder-bottom-right-radiusborder-bottom-styleborder-bottom-widthborder-collapseborder-imageborder-image-outsetborder-image-repeatborder-image-sliceborder-image-sourceborder-image-widthborder-leftborder-left-colorborder-left-styleborder-left-widthborder-radiusborder-rightborder-right-colorborder-right-styleborder-right-widthborder-spacingborder-styleborder-topborder-top-colorborder-top-left-radiusborder-top-right-radiusborder-top-styleborder-top-widthborder-widthbottombox-decoration-breakbox-shadowbox-sizingcaption-sideclearclipcolorcolumn-countcolumn-fillcolumn-gapcolumn-rulecolumn-rule-colorcolumn-rule-stylecolumn-rule-widthcolumn-spancolumn-widthcolumnscontentcounter-incrementcounter-resetcursordirectiondisplayempty-cellsfilterflexflex-basisflex-directionflex-flowflex-growflex-shrinkflex-wrapfloatfont@font-facefont-familyfont-sizefont-size-adjustfont-stretchfont-stylefont-variantfont-weightheightleftletter-spacingline-heightlist-stylelist-style-imagelist-style-positionlist-style-typemarginmargin-bottommargin-leftmargin-rightmargin-topmax-heightmax-widthmin-heightmin-widthopacityoutlineoutline-coloroutline-offsetoutline-styleoutline-widthoverflowoverflow-xoverflow-ypaddingpadding-bottompadding-leftpadding-rightpadding-toppage-break-afterpage-break-beforepage-break-insideperspectiveperspective-originpositionquotesresizerighttab-sizetable-layouttext-aligntext-align-lasttext-decorationtext-decoration-colortext-decoration-linetext-decoration-styletext-indenttext-justifytext-overflowtext-shadowtext-transformtoptransformtransform-origintransform-styletransitiontransition-delaytransition-durationtransition-propertytransition-timing-functionunicode-bidivertical-alignvisibilitywhite-spacewidthword-breakword-spacingword-wrapz-index
\n\nCSS color Property
\n\nDefinition and Usage
\n\nThe color property specifies the color of text.
Tip: Use the background-color property to set the background color of an element.
Default Value:
\n\n| Property | \nDefault Value | \n
|---|---|
| color | \nDepends on the browser | \n
Inheritance:
\n\n| Property | \nInheritance | \n
|---|---|
| color | \nYes | \n
Browser Support
\n\n| Property | \nChrome | \nIE | \nFirefox | \nSafari | \nOpera | \n
|---|---|---|---|---|---|
| color | \nYes | \nYes | \nYes | \nYes | \nYes | \n
All major browsers support the color property.
Note: IE7 and earlier versions do not support the inherit value. IE8 requires a !DOCTYPE. IE9 and above fully support inherit.
Syntax
\n\ncolor: color|initial|inherit;\n\n\nProperty Values
\n\n| Value | \nDescription | \n
|---|---|
| color | \nSpecifies the color of text. See CSS Legal Color Values for possible color values. | \n
| initial | \nSets this property to its default value. See initial. | \n
| inherit | \nInherits this property from its parent element. See inherit. | \n
Example
\n\nExample 1
\n\nSet different text colors:
\n\nbody {color:red;}\nh1 {color:#00ff00;}\np.ex {color:rgb(0,0,255);}\n\n\n\n\nExample 2
\n\nUse "inherit" to set text color:
\n\nbody {color:red;}\nspan {color:inherit;}\n\n\n\n\nRelated Pages
\n\nCSS Tutorial: CSS Text
\n\nHTML Tutorial: HTML Styles
\n\nHTML DOM Reference: color property
\n\n\n\n\n\n
YouTip