Even though Divi requires no knowledge of code, designers will find their websites a step above the rest by gaining an understanding of CSS.
While there are hundreds of articles written about CSS in the general sense, there aren’t all that many that have been adapted for use specifically for Divi.
Beyond the ‘copy and paste’ tutorial style CSS for Divi articles, we wanted to make sure that Divi users understand the basic underlying principles of CSS and why it should be a priority to learn the ins and outs of the syntax in relation to the HTML elements used in the Divi framework.
The following blog post aims to give you a deeper understanding of CSS as a syntax. It’ll discuss:
- What CSS is and how CSS works,
- A short introduction to foundation CSS principles,
- Why learning CSS should be a priority if you’re a web designer,
- Why CSS and child themes go hand in hand, and,
- Where you can learn CSS for Divi.
Like anything in life, learning a new skill can be overwhelming in the beginning, but if you’re ready for the challenge, you’ll transform the nature of your business for the better.
Not only will learning CSS help your immediate web design projects, but it’ll also have a serious, positive impact on your career.
What is CSS?
CSS stands for Cascading Style Sheets, with emphasis on the word “cascading”. CSS is a language that when written and applied applied to an HTML element, will give the element a new look and feel.
If you think of HTML as the content and general structure of the website, then think of CSS as the design style that influences various aspects of these elements, such as color, style, font size, margins, padding and much more. CSS offers a wide range of element styling options, some of which we’ll take a look at as we progress through a number of blog posts.
CSS commands are two-fold. CSS is comprised of :
- The selector: this defines which HTML element in your website you’d like to style, and
- The declaration: this is the actual styling itself, broken down further into:
- The property: this is the aspect of the HTML element you’d like to change (ie. do you want to change the color, font-size, border-width of the element),
- The value: this is the style variation you’d like to apply (i.e. color becomes green or blue, font-size becomes 12px or 20px, and border-width becomes 2px or 3px etc.)
Without diving into this too much (we’ll save more exciting CSS stuff for the future), there are a few things to keep in mind when learning the basics of CSS.
The use of the word ‘Cascading’ in CSS relates to the order in which commands are executed.
In CSS, commands are run from the ‘bottom-up’, in other words, commands written at the top of a CSS file can be overridden by another command issued further down in the same file, or in another linked CSS file.
The main take away here is that it is important to give consideration to the order of things when writing CSS.
Without diverting too much, it’s worth noting that another level of prioritization can be added to an element with the use of either CSS Classes or IDs.
Classes and IDs are selectors that can be used to diversify elements and the styling thereof even further. If you’re familiar with the Divi builder, you would have noticed ‘CSS Class’ or ‘CSS ID’ in the Advanced tab.
Why CSS Should Be the First Syntax you Learn
While Divi’s Out-of-The-Box look is generally appealing, some users may want to create a more unique aesthetic for their website.
Sure, the modules of the Divi Builder can be styled and customized using in the various settings in the Design tab, and beyond this, the Custom CSS tabs offer the ability to add CSS styling to each module.
While this may suffice for small tweaks, if you’re looking to create a particular look and feel for your website, or wish to add deeper levels of personalization to your website, you’ll need to become familiar with CSS.
For example, what if you want to change the color of a header and have this look echo throughout your site? Do you really want to find the header module on each and every page and manually change the color? No, instead you would want to make this change in one location and have it reflect the change in the headers throughout the site, or where necessary.
CSS 101: Use a Child Theme
Before diving into the demonstrations of CSS with Divi, it’s important to mention that, it is deemed as best practice that CSS edits be made with the use of a child theme. Using a child theme entails setting up a stylesheet to house all of your styling edits. This way, site edits will be preserved and won’t be overwritten when a theme update rolls around.
For those wanting to skip the child theme step but still preserve their site changes, Divi allows users to add CSS in a number of areas:
- Styling can be added to the Custom CSS area in the Divi Theme Options > General tab
- Quick, simple aesthetic changes can be added to the sections, rows and individual modules themselves (in the Advanced > Custom CSS tab of each)
Keeping track of multiple styles can become a challenge, so it’s advised to use the Divi Theme Options Custom CSS area as opposed to the individual modules when dealing with many tweaks and edits. While the Divi Theme Options Custom CSS area and a stylesheet will produce the same result, opting to go the child theme route allows you to keep all of your site edits (unique styles, functions, new files) in a separate location, and also, will allow you to manage multiple stylesheets easier.
Understanding child themes (why they’re important, how they function, how to create one etc) is will be explained in detail during the course. For more information on child themes, read the following blog posts:
- Everything You Need to Know About Using a Child Theme with WordPress and Divi
- What Is The Difference Between a Child Theme and a Premium Divi Child Theme
If you’re ready to create a blank child theme for your Divi website, check out the Divi Space child theme generator.
Once you’ve created, installed and activated your child theme, the second thing you do is open the stylesheet.css file in your child theme folder and start adding your customisations.
In the long term, CSS should be executed by adding customizations to the style.css stylesheet in the child theme. Alternately, you could add CSS to the Custom CSS area of the Divi Theme Options section.
We’ll follow up this topic with a few blog posts that’ll help you discover the power that CSS can have in a Divi website.
Learn CSS with Divi Space!
If you’re ready to become a rockstar Divi designer, learning CSS is the next step, and who better to learn this incredible skill set with than Divi Space and the Divi Space founder, SJ James himself!
Our popular Divi Space CSS is back for round two! Now, bigger, bolder and better than ever, Transforming Divi with CSS and JQuery has taken Divi’s exponential growth into account.
With Transforming Divi with CSS and JQuery under your belt, you’ll be able to:
- Design better websites and propel your business
- Research new concepts and code work with confidence
- Charge higher rates for your website design projects
- Take on even bigger projects for higher acclaim
We’ll be releasing more information about the course – Transforming Divi with CSS and JQuery – in the next coming weeks!
Stay tuned to our website and social channels for more information!
We want to hear from you!
How do you feel about learning CSS? Is it something you’d like to do, or would you rather not learn the skill? What’s keeping you back? Has learning CSS helped your web design business?
Share your stories us! Simply comment in the space below.
Thanks for reading