- HTML Tutorial
- HTML - Home
- HTML - Introduction
- HTML - Editors
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Headings
- HTML - Paragraphs
- HTML - Fonts
- HTML - Blocks
- HTML - Style Sheet
- HTML - Formatting
- HTML - Quotations
- HTML - Comments
- HTML - Colors
- HTML - Images
- HTML - Image Map
- HTML - Iframes
- HTML - Phrase Elements
- HTML - Meta Tags
- HTML - Classes
- HTML - IDs
- HTML - Backgrounds
- HTML Tables
- HTML - Tables
- HTML - Headers & Caption
- HTML - Table Styling
- HTML - Table Colgroup
- HTML - Nested Tables
- HTML Lists
- HTML - Lists
- HTML - Unordered Lists
- HTML - Ordered Lists
- HTML - Definition Lists
- HTML Links
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML Color Names & Values
- HTML - Color Names
- HTML - RGB
- HTML - HEX
- HTML - HSL
- HTML Forms
- HTML - Forms
- HTML - Form Attributes
- HTML - Form Control
- HTML - Input Attributes
- HTML Media
- HTML - Video Element
- HTML - Audio Element
- HTML - Embed Multimedia
- HTML Header
- HTML - Head Element
- HTML - Adding Favicon
- HTML - Javascript
- HTML Layouts
- HTML - Layouts
- HTML - Layout Elements
- HTML - Layout using CSS
- HTML - Responsiveness
- HTML - Symbols
- HTML - Emojis
- HTML - Style Guide
- HTML Graphics
- HTML - SVG
- HTML - Canvas
- HTML APIs
- HTML - Geolocation API
- HTML - Drag & Drop API
- HTML - Web Workers API
- HTML - WebSocket
- HTML - Web Storage
- HTML - Server Sent Events
- HTML Miscellaneous
- HTML - MathML
- HTML - Microdata
- HTML - IndexedDB
- HTML - Web Messaging
- HTML - Web CORS
- HTML - Web RTC
- HTML Demo
- HTML - Audio Player
- HTML - Video Player
- HTML - Web slide Desk
- HTML Tools
- HTML - Velocity Draw
- HTML - QR Code
- HTML - Modernizer
- HTML - Validation
- HTML - Color Picker
- HTML References
- HTML - Cheat Sheet
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
- HTML Resources
- HTML - Quick Guide
- HTML - Useful Resources
- HTML - Color Code Builder
- HTML - Online Editor
HTML - HEX Colors
HTML HEX colors are used to define web page colors with hexadecimal values, a number system utilizing 16 symbols: 0-9 and A-F.
HEX Color Codes in HTML
Each HEX color code starts with a hash sign (#) and includes six digits. The first two digits specify the red component, the next two indicate the green component, and the final two represent the blue component. This method allows precise color customization for web design.
To use hex colors in HTML, we can either assign them directly to an element using the style attribute, or define them in a style tag or sheet using the color property.
<element style="color: #FFFFFF;">
Hexadecimal Color Codes
Following is a list of few colors using hexadecimal notation:
Color | Color HEX |
---|---|
#000000 | |
#FF0000 | |
#00FF00 | |
#0000FF | |
#FFFF00 | |
#00FFFF | |
#FF00FF | |
#C0C0C0 | |
#FFFFFF |
Examples of HTML Hex Colors
Here are some example that shows how to use Hexadecimal Colors in HTML pages.
Setting Background Color for Body
Here is an example to set background of HTML tags by color code in hexadecimal.
<!DOCTYPE html> <html> <head> <title> HTML Colors by HEX code </title> </head> <body style="background-color: #00FF00;"> <p> Use different color code for body and table and see the result. </p> <p style="color: #FFFFFF;"> This text will appear white on black background. </p> </body> </html>
Setting Color on Table Cells
This is another example that demonstrates use of HEX code.
<!DOCTYPE html> <html> <head> <title> HTML HEX Color code </title> </head> <body style="width:300px; height:100px;"> <h2 style="background-color: #FF6666;"> Setting the Background using HEX Code </h2> <table style="background-color: #FF3335;"> <tr> <td style="color: #FFFFFF;"> The text color of the paragraph is styled using HEX code. </td> </tr> </table> </body> </html>
Conclusion
Selecting right colors for designing a webpage is difficult. Even if you have a color in your mind, You need to make a computer understand hexadecimal value of color. To make your job easier we suggests using our HTML color picker tool.