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

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.


Upload Image, display, edit and delete i...
Login Form with Image background...
How to Create an Image with Transparent ...
Portfolio Gallery Website with filtering...
Simple pagination script PHP MySQLi...
Center Image in div...
Image Hover Overlay Fade...
Sticky image / element / div on scroll...
Responsive images...
Create rounded image in HTML CSS...
Add border around image...
Position Text Over an Image HTML CSS res...
Create a Slideshow Images Gallery...
Create a Sticky Sidebar...
Search bar using CSS HTML...
Shrink Navigation Menu on Scroll...
How to Create Accordion HTML Templates...
Dropdown menu in the navigation bar...
Responsive Top Navigation Bar with mobil...
Split horizontal navigation bar...