Hướng dẫn mã màu css w3school
Colors are displayed combining RED, GREEN, and BLUE light. Show Color NamesWith CSS, colors can be set by using color names: CSS Color ValuesWith CSS, colors can be specified in different ways:
RGB ColorsRGB color values are supported in all browsers. An RGB color value is specified with: rgb( RED , GREEN , BLUE ). Each parameter defines the intensity of the color as an integer between 0 and 255. For example, rgb(0,0,255) is rendered as blue, because the blue parameter is set to its highest value (255) and the others are set to 0. Example
Try it Yourself » Shades of gray are often defined using equal values for all the 3 light sources: Example
Try it Yourself » Hexadecimal ColorsHexadecimal color values are also supported in all browsers. A hexadecimal color is specified with: #RRGGBB. RR (red), GG (green) and BB (blue) are hexadecimal integers between 00 and FF specifying the intensity of the color. For example, #0000FF is displayed as blue, because the blue component is set to its highest value (FF) and the others are set to 00. Example
Try it Yourself » Shades of gray are often defined using equal values for all the 3 light sources: Example
Try it Yourself » Upper Case or Lower Case?You can use upper case or lower case letters to specify hexadecimal values. Lower case are easier to write. Upper case are easier to read. Color NamesCSS supports 140 standard color names. In the next chapter you will find a complete alphabetical list of color names with hexadecimal values:
The currentcolor KeywordThe ExampleThe border color of the following element will be blue, because the text color of the element is blue:
#myDIV { Try it Yourself » W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy. Copyright 1999-2022 by Refsnes Data. All Rights Reserved. CSS is the language we use to style an HTML document. CSS describes how HTML elements should be displayed. This tutorial will teach you CSS from basic to advanced. Start learning CSS now » Examples in Each ChapterThis CSS tutorial contains hundreds of CSS examples. With our online editor, you can edit the CSS, and click on a button to view the result. CSS Example body { h2 { p { Try it Yourself » Click on the "Try it Yourself" button to see how it works. CSS ExamplesLearn from over 300 examples! With our editor, you can edit the CSS, and click on a button to view the result. Go to CSS Examples! Use the MenuWe recommend reading this tutorial, in the sequence listed in the menu. If you have a large screen, the menu will always be present on the left. If you have a small screen, open the menu by clicking the top menu sign ☰. CSS TemplatesWe have created some responsive W3.CSS templates for you to use. You are free to modify, save, share, and use them in all your projects. Free CSS Templates! CSS ExercisesCSS QuizTest your CSS skills with a quiz. Start CSS Quiz! My LearningTrack your progress with the free "My Learning" program here at W3Schools. Log into your account, and start earning points! This is an optional feature. You can study W3Schools without using My Learning.
CSS ReferencesAt W3Schools you will find complete CSS references of all properties and selectors with syntax, examples, browser support, and more. Kickstart your careerGet certified by completing the course Get certified w3schoolsCERTIFIED.2022 |