xFactorSchool.com
Python
JavaScript
How to Do Examples
C Examples
Python Examples
HTML Examples
Code Examples
C Code Examples
C++ Code Examples
C# Code Examples
Java Code Examples
Python Code Examples
HTML Code Examples
CSS Code Examples
JavaScript Code Examples
Online Compilers
C Compiler
C++ Compiler
C# Compiler
Java Compiler
Python Compiler
HTML Code Editor
CSS Code Editor
JavaScript Compiler
JavaScript Code Editor
Practice how to apply internal CSS style to HTML elements using HTML class name in an HTML page
HTML Online Editor
Run Code
More HTML Sample Codes
<!DOCTYPE html> <html> <head> <title>CSS Style Class in HTML Page</title> <!-- Title of the page--> <!--This is an example of internal css style.--> <style> /*This is an example of HTML class to apply css style.*/ /* . (period/fullstop) is used to define class in css style.*/ .test { color: red; font-size: 18px; } </style> </head> <body> <h1>Example of HTML Class to Apply CSS Style in a Webpage</h1> <hr /> <h3>CSS style element added in the head element. Color and font size of the following lines have been changed using HTML class as selector.</h3> <p class="test">You can use HTML class as selector in <style> element within head element to apply CSS style.</p> <p>.test{"color: red; font-size: 18px;"} is used in the style element within the head element to apply CSS style to all HTML elements with class="test" attribute in the document.</p> </body> </html>