Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow targetting of a class rather than an ID in CSS examples #1263

Open
rachelandrew opened this issue Dec 8, 2018 · 2 comments
Open

Allow targetting of a class rather than an ID in CSS examples #1263

rachelandrew opened this issue Dec 8, 2018 · 2 comments
Labels
idle Issues and pull requests with no activity for three months.

Comments

@rachelandrew
Copy link
Collaborator

I have an issue where to make a CSS example for the CSS property scroll-snap-align behave consistently I need to be able to apply the selected value to all child nodes.

Currently I believe I can only target one element, by giving it the ID example-element. I actually need to target that element and all of the siblings. Would it be possible to make it so that a class can be targeted instead as this would mean I could apply the property to all children. Otherwise I think the solution will be to use some JavaScript to do so.

In the example below, I want to be able to apply scroll-snap-align to all of the children and not just the one with the ID.

<section id="example-choice-list" class="example-choice-list large" data-property="scroll-snap-align">
    <div class="example-choice" initial-choice="true">
        <pre><code class="language-css">scroll-snap-align: none;</code></pre>
        <button type="button" class="copy hidden" aria-hidden="true">
            <span class="visually-hidden">Copy to Clipboard</span>
        </button>
    </div>
    <div class="example-choice">
        <pre><code class="language-css">scroll-snap-align: start;</code></pre>
        <button type="button" class="copy hidden" aria-hidden="true">
            <span class="visually-hidden">Copy to Clipboard</span>
        </button>
    </div>

    <div class="example-choice">
        <pre><code class="language-css">scroll-snap-align: end;</code></pre>
        <button type="button" class="copy hidden" aria-hidden="true">
            <span class="visually-hidden">Copy to Clipboard</span>
        </button>
    </div>

    <div class="example-choice">
        <pre><code class="language-css">scroll-snap-align: center;</code></pre>
        <button type="button" class="copy hidden" aria-hidden="true">
            <span class="visually-hidden">Copy to Clipboard</span>
        </button>
    </div>
</section>

<div id="output" class="output large hidden">
    <section id="default-example" class="default-example">
        <div class="scroller">
            <div>1</div>
            <div id="example-element">2</div>
            <div>3</div>
        </div>
    </section>
</div>
@welcome
Copy link

welcome bot commented Dec 8, 2018

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it.

@wbamberg
Copy link
Contributor

wbamberg commented Dec 8, 2018

I can't think of any reason not to do this, unless it's terribly complicated to implement.

@github-actions github-actions bot added the idle Issues and pull requests with no activity for three months. label Dec 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idle Issues and pull requests with no activity for three months.
Projects
Development

No branches or pull requests

2 participants