LearnCode

A Simple Website to Learn Programming

Home Courses Learn HTML Learn CSS About / Contact

Learn CSS

What is CSS?

CSS stands for Cascading Style Sheets. It is used to style HTML elements, such as changing their color, size, and spacing. In this project, CSS is written directly inside HTML tags using the style attribute. This is called inline CSS.

Topics Covered on This Page

Text Color

<p style="color: blue;">This is blue text.</p>

This is blue text.

Background Color

<p style="background-color: green; color: white;">Green Background</p>

Green Background

Font Size

<p style="font-size: 20px;">This text is bigger.</p>

This text is bigger.

Text Alignment

<p style="text-align: center;">Centered Text</p>

Centered Text

Border

<div style="border: 2px solid black;">Box with Border</div>
Box with Border

Width and Padding

<div style="width: 150px; padding: 10px; border: 1px solid black;">Box</div>
Box

CSS Properties Table

Property Purpose
color Sets the text color
background-color Sets the background color
font-size Sets the size of the text
text-align Aligns text left, center, or right
border Adds a border around an element
width Sets how wide an element is
padding Adds space inside an element
Sir Signature

LearnCode - Student Project - 2026