We have all been there. Just set up a site, installed Divi and opened up tutorial number 4 of how to use Divi to make a cracking website – only to get an error… Expected RBrace Unexpected Token.
Now unless you are familiar with coding this could feel like they are speaking Klingon to you for all you know. Frustration creeps in and you end up going a different route.
Well, the good thing is that I am here to tell you that this is not a big issue and hopefully I will have you sorted out by the end of this tutorial.
Expected RBRACE and Unexpected Token Issue
When you are using the Divi modules to enter CSS in order to style the element to the way you want it, there is often a chance of this issue arising.
I know all the red warnings or errors can be a bit of a shock but let’s examine the errors itself.
Expected RBRACE – all this means is that the right curly bracket is missing. Kind of strange for this error to display as I am sure you can clearly see the the right curly bracket is being displayed right?
We will get to that in a second but first let’s look at the other error.
Unexpected token ‘}’ – This error is telling you that there is this foreign element here that should not be here and therefore was unexpected. In this case it is a } which you guessed it, is a right curly bracket!
So what is going on here? Why the contradiction?
Well this is due to the way that these modules are designed by Elegant Themes. They tried to make it as simple for us to use as possible and even left us some clues in the settings box.
So here they are telling us to enter the css WITHOUT writing the selectors name. But what is the selector’s name?
The selectors name is the id given to an element that will distinguish it from the rest of the elements. This is useful so that when we target it with CSS, it will only affect that selector and not the rest of the site.
If you click on the ? next to the Main Element, you will see the class name.
So let’s give this a go and remove the selector and the brackets as instructed by the message at the top.
and there you go – it works just fine!
Expected RBRACE Issue in Theme Options
If you come across this issue while entering CSS in the Divi -> Theme Options -> General -> Custom CSS area, then it is likely you have just forgotten to add a right curly bracket } somewhere.
And that is it! That should solve the dreaded Expected RBRACE and Unexpected Token errors that come to light every so often.
Happy building!