mdn / interactive-examples

Home of the MDN live code editor interactive examples
Creative Commons Zero v1.0 Universal
731 stars 510 forks source link

fix(css): update 'display' interactive demo #2710

Closed OnkarRuikar closed 9 months ago

OnkarRuikar commented 9 months ago

Screenshot

demo

dipikabh commented 9 months ago

This is close. But I think the additional text in the example does not fully clarify the element on which display is being set, especially considering that the OP in the issue expected each child element to have its own display setting.

Brainstorming an idea here. How about we add a description outside the div to explain the example, something like "The orange element represents the div on which different display values are set. It contains three child elements." This can be followed by:

    <div class="example-container">
      some text A
      <div id="example-element">
        <div class="child">Child 1</div>
        <div class="child">Child 2</div>
        <div class="child">Child 3</div>
      </div>
      some text B
    </div>

With display: none, the current text in the proposed PR reads: "Change display property of this div element.". It refers to the div element that gets hidden when display: none. Instead of using a complete sentence, using placeholders like "some text A" and "some text B" could demonstrate the absence of the div more effectively. With display: none, the output would read "some text A some text B"", indicating that the div is not displayed.

Let me know what you think.

OnkarRuikar commented 9 months ago

How about we add a description outside the div to explain the example, something like "The orange element represents the div on which different display values are set. It contains three child elements." This can be followed by:

@dipikabh Yes, we need to be more explicit.

OnkarRuikar commented 9 months ago

@dipikabh you'll have to merge https://github.com/mdn/interactive-examples/pull/2716 as well to make it live.

dipikabh commented 9 months ago

you'll have to merge https://github.com/mdn/interactive-examples/pull/2716 as well to make it live.

Done 👍

wbamberg commented 9 months ago

Thanks! FWIW I agree with @dipikabh that we should try very hard to keep interactive examples self-contained. And that really any kind of exposition in the examples is unfortunate, but sometimes as in this case it is unavoidable (as also for instance here: https://developer.mozilla.org/en-US/docs/Web/CSS/position). But I think what you have here is perfect :).