AgerNic.com
WEB DEVELOPER SITE, HTML, CSS, PHP, SQL
HTML Tutorial

CSS font color


In this online tutorial we'll show you how to manipulate CSS to color any HTML text element using an HTML tag, ID or class.

CSS text color - font color using an HTML tag - example


For the beginning let's color a simple text or paragraph. In the following example, we will use the <h1> tag and <p> tag.

Example 1:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS text color - font color using an HTML tag - example</title>
<meta name="description" content="Tutorial to learn how tu use CSS text color - font color using an HTML tag - example" />

<style type="text/css">
h1 { color: red; }
p { color: blue; }
</style>
</head>
<body>

<h1>This is how to color the heading title. Any written text between <h> </h1> tags will get red color.</h1>
<p>Any written text between <p> </p> tags will get blue color.</p>

</body>
</html>
HTML cod above will display this result -

This is how to color the heading title. Any written text between <h> </h1> tags will get red color.

Any written text between <p> </p> tags will get blue color.

Note: There are no browser defaults for any ID or Class

CSS text color using an ID - How to create.


Another way to color <h1> element is by giving it an ID; in the next example we'll show you how to use the ID of 'heading'. IDs can be styled using CSS in the same way as HTML tags, but starting with '#' symbol.

Example 2:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS text color - font color using an HTML tag - example</title>
<meta name="description" content="Tutorial to learn how tu use CSS text color - font color using an HTML tag - example" />

<style type="text/css">
#heading { color: #033; }
#paragraph { color: blue; }
</style>
</head>
<body>

<h1 id="heading">This is how to color the heading title. Any written text between <h> </h1> tags will get red color.</h1>
<p id="paragraph">Any written text between <p> </p> tags will get blue color.</p>

</body>
</html>
The HTML cod above will display this result -

This is how to color the heading title. Any written text between <h> </h1> tags will get - #003 - color.

Any written text between <p> </p> tags will get blue color.

CSS text color using class


A third method for adding color to HTML elements is by using class – what is similar to ID, but the difference it makes is a dot "." prefixed instead of a "#".

Example 3:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS text color - font color using an HTML tag - example</title>
<meta name="description" content="Tutorial to learn how tu use CSS text color - font color using an HTML tag - example" />

<style type="text/css">
.heading { color: #033; }
.paragraph { color: blue; }
</style>
</head>
<body>

<h1 class="heading">This is how to color the heading title. Any written text between <h> </h1> tags will get red color.</h1>
<p class="paragraph">Any written text between <p> </p> tags will get blue color.</p>

</body>
</html>

This HTML code will produce the following result −

This is how to color the heading title using class. Any written text between <h> </h1> tags will get - #003 - color.

Any written text between <p> </p> tags will get blue color.

Note: CSS text color using class


CSS font color
CSS font color - css tutorial

Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


CSS Scrollbar Horizontal
CSS Scrollbar in Div
CSS Scrollbar Firefox
CSS Style Scrollbar
CSS Style Text
CSS background color
CSS Div Id Class
CSS Text Wrap
CSS text-align
CSS Text Decoration
CSS Text Shadow
CSS Text Color
CSS Text Bold
CSS Text Size
CSS background image full
CSS background opacity
CSS border radius
CSS rounded corners
CSS font color
CSS Class & ID
CSS align image center
CSS align content
CSS link color
CSS Text Style
CSS Text Font Size
CSS max width &height
CSS width and height
CSS Margin
CSS Padding
CSS Border Style
CSS background
CSS in HTML
Basic Syntax of CSS
CSS Introduction
Online Editor
ONLINE EDITOR

news templates


COLOR PICKER

news templates
This tool makes it easy to create, adjust, and experiment with custom colors for the web.


HTML Templates
news templates
Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.


CSS HTML Layout
news templates
Find here examples of creative and unique website layouts.


Free CSS HTML Menu
news templates
Find here examples of creative and unique website CSS HTML menu.


PHP convert array to string with commas...
PHP array to comma separated string with...
How to put text in image HTML...
How to insert text in html code using ja...
PHP array_key_exists() Function...
Bootstrap Templates...
Bootstrap Text...
Bootstrap Accordion...
Bootstrap Scrollspy...
Bootstrap Carousel...
Bootstrap Modal...
Bootstrap Responsive Layout...
Bootstrap Fluid Layout...
Bootstrap Fixed Layout...
Bootstrap Grid...
Bootstrap Input...
Bootstrap Icon...
Bootstrap Dropdown...
Bootstrap Navigation Bar...
Bootstrap Pagination...