HTML:
<nav>
<ul>
<li>
<a href="/">
<span class="m-icon fa fa-close"></span>
<span class="m-title">Title 1</span>
</a>
</li>
<li>
<a href="/">
<span class="m-icon fa fa-close"></span>
<span class="m-title">Title 2</span>
</a>
</li>
</ul>
</nav>
CSS:
.m-title {
border: 1px solid #c42;
}
Problem:
I have this code and the class m-title
doesn't work. When I use Chrome inspector tool, the class doesn't appear. I tried to change the class by an id, but the issue persists.
If I modify the CSS
.m-title, .test {
border: 1px solid #c42;
}
the border was displayed. Why does this ocurr?
Checked:
- The classes were added to final CSS file.
- All the CSS code is generated by SASS and it doesn't contain errors (not missing brackets, etc).
- The issue ocurrs in Chrome, Firefox and Safari (MacOS and Windows).
UPDATE:
I have more cases in my project of CSS clases that don't work (and they should) and I saw a pattern in all. It looks like the final CSS generated by SASS introduces some spaces after the class name. These spaces are added only when I use nested classes.
Here a simplified example: https://jsfiddle.net/cespon/qw34g1tp/1/