When combining selectors does space means the same as no space?

css, css-selectors, html

Solution

Yes, spaces are significant in CSS rules.

`#tag.flower` means an element with both `id="tag"` and `class="flower"`, where `#tag .flower` means an element with `class="flower"` inside of an element with `id="tag"`.

For instance:

`#tag.flower`

<div id="tag" class="flower"></div>

`#tag .flower`

<div id="tag">
    <div class="flower"></div>
</div>

Problem

In CSS combining selectors with space means descendance. But in another answer How to combine class and ID in CSS selector? I read, that similar syntax means coinciding selected markers in one tag. Does CSS parser really distinguish space and no-space, or this is the same syntax which is just working in both cases?

Original source

Related problems