What programming languages does WordPress use? Part 2

In the first part of our two-part series on web programming languages used in WordPress, we discussed HTML, JavaScript, and PHP, three common programming languages used in WordPress. In this article, we’ll cover one final language WordPress uses, CSS.

CSS — cascading style sheets — is another essential language for the Web. CSS functions as a shortcut for any kind of styling and formatting. Using HTML only, you must specify every instance in which something changes. For example, HTML once offered a <font> tag to specify the font you’d use in a given section of text. Imagine how cumbersome it would be to change your font throughout your website with this method, though. If you have 200 pages on your website, you’d have to change the font tag on all 200 pages!

That’s where CSS comes in. You can use CSS to designate fonts, colors, and even very complicated style settings and standardize them across your website. CSS uses three methods for doing so.

Applying CSS to HTML tags

The first method of applying CSS is to apply it to an HTML tag. For example, you can tell your website to make all heading 1 tags bold:

h1 {font-weight: bold;}

Since WordPress will embed your CSS file into each page of your site, this will make all heading 1 tags bold automatically. As you can see, like HTML, CSS uses sensical language so it’s pretty easy to figure out, although you’ll likely want to take a CSS tutorial if you’re planning to make regular edits to your CSS. Using the wrong syntax will cause your changes to fail.

Using classes or IDs for CSS

Additionally, CSS can be applied two other ways, with classes and IDs. They function similarly. You can apply a CSS class or ID to a specific section of your website and then specify CSS code to only apply to that specific class or ID.

Why is this useful? Let’s say you want to add special emphasis to certain text on your site, so you decide to make them bold. Later, you decide bold is a little too much and you’d rather use italics for that. Using HTML only, you’d have to find each instance of bold across your site and manually replace it with italics. With CSS, you can simply change the code for that class once and your entire website will automatically update at once.

The Customizer and CSS

In WordPress, the Customizer gives you an easy way to manage most styling on your website. You’ll want to take caution adding CSS on your own, because your CSS might conflict with the Customizer. If you add manual CSS, you’ll want to first ensure you’re specifying something that is not already available in the Customizer. Use the Customizer when possible to avoid these conflicts.

Comments