The error “Expected RBRACE” generally occurred if the right brace “}” is missing from our CSS code. Sometimes when we style an element, we forget to close the right brace. As a result, we will get an error i.e. “expected rbrace at line no“.
CONTENTS
What does expected rbrace mean?
Whenever we style an element, we need to select the style by query selector. The opening and closing brace “{}” is used to enclose the style property of that element like below.
.selector{
position: relative;
font-family: sans-serif;
font-size: 20px;
}
But what if we forgot to write the right brace “}”? We can’t get the expected result as the rest of the code will not going to work. See the below example.
.selector{
position: relative;
font-family: sans-serif;
font-size: 20px;
}
Also if we forget to write the left brace “{“, we will also get the “expected lbrace at line no” error.
How to fix “Expected RBRACE” error at the media query?
We can also get the error when using media-query in CSS. So when we write media-query, we have to also enclose all elements with their element style in opening and closing brace “{}”. We also get the above error if there is missing any closing and the opening brace.
@media (min-width: 576px) {
.selector {
background-color:#f00;
}
}
Summery
In CSS, it is a common practice to group elements in a group or nested group, we have to use a brace. If one brace is missing it may be opening or closing, it will affect on next element’s group.