Can blocks have other blocks as children, or only elements are allowed? #225
-
Imagine the following component:
Is it allowed to have another block
Thanks for the clarification. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
If |
Beta Was this translation helpful? Give feedback.
-
It can combine element and block in one DOM node, more of it - has not do it. Rule of thumb - every block is an element. As usual Block cannot specify own dimensions and this part of styling belongs to an “Element” definition. <div class="card">
<div class="card__heading heading">...</div>
<div class="card__body">...</div>
<div class="card__footer">...</div>
</div> |
Beta Was this translation helpful? Give feedback.
If
heading
styles does not rely oncard_heading
(ex. for positioning or padding insidecard
) it is perfectly fine to removecard__heading
wrapper element.