Flexbox instructions


#1

In the “Display and Position” lesson it says in the explanation from Codecademy (bold added by me):

‘If we didn’t want div elements to be block-level elements, we would use display: inline. Flexbox, however, provides the inline-flex value for the display attribute, which allows us to create flex containers that are also inline elements.’

I thought display is a property, not attribute. Can it also be called an attribute in the context of CSS rules?

From the lesson:

<div class="container">
  <p>I’m inside of a flex container!</p>
  <p>A flex container’s children are flex items!</p>
</div>
<div class="container">
  <p>I’m also a flex item!</p>
  <p>Me too!</p>
</div>

.container {
  width: 200px;
  height: 200px;
  display: inline-flex;
}

#2

A property is an attribute, and vice versa. It’s just that we do not often call HTML attributes, properties or object properties, attributes. All HTML elements are objects, and the attributes are its properties.

Yes. Selector rule sets are objects, too. It is more common to see property in the description of CSS syntax, but in terms of objects, attribute is synonymous.

https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement


#3

This topic was automatically closed after 7 days. New replies are no longer allowed.