The Absolute Beginner’s Guide to CSS: From HTML Basics to WordPress Customization

beginners guide to css in wordpress



Have you ever wondered how the beautifully designed websites you visit every day are created? The secret lies in the trio of web development languages: HTML, CSS, and JavaScript. Today, we will focus on CSS (Cascading Style Sheets), the language that gives websites their unique look and feel.

To grasp the importance of CSS, we must first understand HTML (HyperText Markup Language). HTML is the backbone of all websites. It allows developers to structure web content, creating various elements like paragraphs, headers, links, and images. Think of HTML as the skeleton of a web page.

Understanding Markup Languages

So, you know when you’re browsing the internet and you see all these websites with text, pictures, links, and maybe even videos? Well, these are not just randomly placed. They are organized in a specific way to look nice and make sense to us. This organization is done with the help of something called a ‘markup language’.

Let’s take HTML as an example. HTML stands for Hypertext Markup Language, and it’s like the ‘skeleton’ or ‘blueprint’ of a website. It tells your web browser (like Google Chrome, Firefox, or Safari) what to show and where to show it. It’s like the director of a play, telling actors where to stand and what to do.

Now, you might be wondering, how does HTML do this? It does this with something called ‘tags’. Tags are like labels or instructions. They are written in angle brackets, like this: < >.

Each type of tag has a specific purpose. For example, the ‘<p>’ tag in HTML is used to tell the browser, “Hey, the text between these tags is a paragraph, so please display it like one.” It’s like putting a title on a box that says “toys,” so everyone knows what’s inside without opening it.

Similarly, the ‘<img>’ tag is used to tell the browser that there is an image that needs to be displayed. The browser then ‘reads’ this tag and understands, “Oh, I need to put a picture here.”

In this way, by using these ‘tags’ or ‘instructions’, a markup language like HTML helps create and structure the content on a web page, making it user-friendly and meaningful to us.

A markup language like HTML provides a way to describe web page structure to the browser. It uses tags to mark up text and other content, providing meaning, context, and structure to the raw content. For instance, the <p> tag denotes a paragraph, while the <img> tag is used for images.

The Birth of HTML: A Short History

HTML originates from a more complex markup language called SGML (Standard Generalized Markup Language). SGML was a system for organizing and tagging elements of a document in the 1980s. Tim Berners-Lee, the father of the World Wide Web, leveraged SGML’s tagging infrastructure to develop HTML, enabling the creation and sharing of web pages.

The First HTML Document: A Minimal Subset of SGML

HTML, as we know it today, is a markup language with a myriad of elements to structure web content. However, the first HTML document was a far cry from this complexity. Tim Berners-Lee, while developing HTML in 1990, introduced a minimal subset of SGML tags that formed the basis for this new language.

These original HTML tags were relatively few and quite simple, primarily focusing on the basic structure and linking of documents. The elements included the <title> to label the document, <h1> through <h6> for defining headers, <p> for paragraphs, <a> for hyperlinks, and <li> for list items, among others. They were designed to mark up scientific documents, allowing easy linking between them on the World Wide Web.

At its core, this first iteration of HTML was about content structure and hyperlinking, not design or visual aesthetics. Those features came much later with the advent of CSS and JavaScript. Reflecting on this humble beginning allows us to appreciate the complex, multi-faceted web development landscape we have today.

Diving into CSS

CSS takes the bare-bones website that HTML creates and makes it beautiful. It adds color to the text, sets the background color or image, arranges things on the screen, and even chooses the font and size of the text.

So if HTML is the structure or the ‘skeleton’ of a website, CSS is like the skin, the clothes, and the accessories that make the website visually appealing.

Now, let’s talk about how CSS does this. A CSS rule is like a set of instructions for the costume designer. It tells the designer what to style and how to style it.

CSS Selectors: The Basics

Think of a CSS selector like the name tag on a piece of clothing. It helps you find what you’re looking for in a big pile of clothes. In the same way, CSS selectors help find the part of the website you want to change.

Let’s say you want to change the color of all the paragraphs on your website. You’ll use ‘p’ as your selector because ‘p’ is the label that HTML uses for paragraphs (it stands for ‘paragraph’).

For example, in this piece of code ‘p {color: blue;}’, ‘p’ is the selector. The stuff inside the curly brackets {} are the style instructions. Here, ‘color: blue;’ is telling the browser “make the text color of all the paragraphs blue.” So, by using ‘p’ as your selector, you’re telling the browser to find all the paragraphs and change their color to blue.

Common CSS Properties

Now, there are a lot of different things you can change about an element on a website using CSS. These different things you can change are called ‘properties’.

Here are some common properties:

  1. ‘color’: This changes the color of the text.
  2. ‘background-color’: This changes the color behind the text.
  3. ‘font-size’: This changes how big or small the text is.
  4. ‘width’ and ‘height’: These change how wide or how tall an element is.
  5. ‘margin’: Remember the CSS box model? This changes the space around the box (or the distance between the element and other things on the page).
  6. ‘padding’: This changes the space between the content and the border of the box (or how much space there is between the text and the edge of its box).

Each property is like a tool in your toolbox. Just like how you’d use a hammer for nails and a screwdriver for screws, you’d use different CSS properties for different aspects of an element you want to change. You can combine them in various ways to make your website look exactly the way you want!

Understanding the CSS Box Model will help you understand how to use CSS with WordPress

Imagine every bit of content on a website – each paragraph of text, every image, every video – as being inside its own invisible cardboard box. This is how the CSS Box Model sees each HTML element on a webpage. Each ‘box’ has a few key parts that you can control the size and look of.

  1. Content: This is what’s actually inside the box. It could be text, an image, a video, or something else.
  2. Padding: Imagine you want to make sure the contents of your box don’t touch the sides and get damaged. In the box model, ‘padding’ is like bubble wrap you put around your content inside the box. It’s space that you add inside the box but outside your content.
  3. Border: Now, each box has edges or sides, right? In the box model, we call these edges the ‘border’. You can decide how thick or thin, and what color or style this border is.
  4. Margin: Finally, you might want to make sure your box doesn’t bump against other boxes, right? In the box model, ‘margin’ is like the space you leave around your box to keep it from touching other boxes. It’s the space outside the border of the box.

So, in a nutshell, the CSS Box Model is a way of thinking about each piece of content on your website like it’s in its own box. And just like with a real box, you can control how much ‘bubble wrap’ (padding) is inside, how thick the ‘sides’ (border) are, and how much ’empty space’ (margin) is around each box. This gives you a lot of control over how your website looks!

Responsive Design with CSS

In today’s multi-device world, responsive web design is essential. CSS makes websites flexible, adjusting the layout to accommodate different screen sizes. This involves using fluid grid layouts, flexible images, and media queries.

So, you know how when you open a website on your computer, it looks a certain way, but when you open the same website on your phone, it still looks good but different? That’s because of something called ‘responsive design’.

Responsive design is like a magic trick that makes a website look good on any device, whether it’s a big computer screen, a small phone screen, or something in between like a tablet. It’s very important nowadays since we use so many different devices to browse the internet.

CSS is the magician that performs this trick. It can make websites ‘flexible’ or ‘responsive’ to adjust to different screen sizes. Here’s how it does it:

  1. Fluid Grid Layouts: Think about a website as being divided into a bunch of invisible squares or ‘grids’. Now, if these grids are ‘fixed’, they stay the same size no matter what. But if they are ‘fluid’, they can stretch or shrink to fit the screen. CSS can create these ‘fluid grid layouts’ to help the website adjust to different screens.
  2. Flexible Images: Just like the fluid grids, images on a website can be fixed or flexible. If they are fixed, they might be too big for a phone screen or too small for a computer screen. But if they are flexible, they can shrink or grow to look good on any screen. CSS can make images flexible.
  3. Media Queries: This is like CSS’s secret tool to check what size the screen is. It’s a bit of code that asks, “How big is the screen?” Then, based on the answer, CSS can apply different sets of rules. For example, if the screen is big (like a computer), it might use one set of rules, and if the screen is small (like a phone), it might use a different set of rules.

CSS in WordPress

WordPress, the world’s leading Content Management System (CMS), leverages the power of both HTML and CSS. They come together to create and customize themes, which are collections of files that dictate a website’s appearance.

WordPress offers two types of themes: classic themes and block themes. Classic themes utilize a PHP template system and a mix of HTML, CSS, and PHP to render your website. CSS is often used in a standalone stylesheet file.

In contrast, block themes, introduced with Full Site Editing (FSE) in WordPress 5.8, represent a shift towards a more user-friendly, block-based editing environment. They heavily rely on HTML and CSS, with each block in the editor representing a standalone piece of the webpage with its own specific styles. This gives users fine-grained control over the layout and design of their site.

The use of CSS in WordPress themes is very flexible. You can use it directly within individual pages or posts, in a theme’s main stylesheet, or within a custom CSS plugin. This versatility makes CSS a powerful tool for customization within the WordPress ecosystem.


Understanding CSS is essential for anyone interested in web design and development. Alongside HTML, it forms the basis for structuring and styling the websites we interact with daily. Whether you’re customizing a WordPress theme or creating a responsive web design from scratch, CSS is a powerful tool that brings your web content to life.

Start with the basics: learn the common CSS properties, understand the box model, and practice applying styles to HTML elements. As with any new skill, the key to learning CSS is patience, persistence, and plenty of practice. Happy coding!

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top