The class I want to change has a space in the beginning, see image.
Does anyone know how to find that class or override it with my own class attributes?
Does . nav { css here }
work?
Joomla Stack Exchange is a question and answer site for Joomla! administrators, users, developers and designers. It only takes a minute to sign up.
Sign up to join this communityThe class I want to change has a space in the beginning, see image.
Does anyone know how to find that class or override it with my own class attributes?
Does . nav { css here }
work?
An element can have multiple classes, separated by a space. Leading and trailing spaces mean nothing. So the class in this case is nav
and the selector is .nav
.
CSS classes and IDs never start with spaces, and they also never have spaces in the middle of it as well.
As Sharky commented, an element can have multiple classes, and those classes must be separated by a space. But keep in mind that an element can have only one ID.
Here is one example:
<div id="mydiv" class="nav menu navbar-collapse">
When a CSS class is added to an element, as above, you must not use the dot. Same is valid for IDs, where you must not use the # symbol when adding it to the element itself.
On the other hand, when adding the styles to your CSS file, you must use the dot for classes, and # for IDs.
Example of class:
.nav {
background: #f1f1f1;
color: #58535b;
}
Example of ID:
#mydiv {
padding: 10px;
}
Joomla, or at least most templates, had, for many years, a problem with the class suffix area/field, where, in most cases, you had to add a space before the first class to avoid problems (because there was no space in the PHP code that loaded the class).
So, for older templates, or older versions of Joomla, you are likely to see the class attribute starting with a space. This is completely harmless, and you can safely ignore it.