The "all" CSS property

  • ERT:

The programmes details at Csaydimba are on top of each other like a stack of cards.

Our goal was, once a user clicks on the programme title, the programme details view should show.

So, to make sure the list item is accessible to assistive technologies and keyboard users we nest the content into a button element in the li element. Because the button element is a focusable element.

Consider the following markup

<ol>
    <li>
        <button>Product Design</button>
        <div>
            <!-- program details comes here -->
        </div>
    </li>
    <li>
        <button>Front-end Engineering</button>
        <div>
            <!-- program details comes here -->
        </div>
    </li>
    <li>
        <button>Back-end Engineering</button>
        <div>
            <!-- program details comes here -->
        </div>
    </li>
</ol>

And consider the following style

button {
    all: inherit;
    /* other declarations */
}

The good button element comes with it package of styles. So, to make sure the button feel like the list item we use the all CSS property to reset it.

The all shorthand CSS property resets all of an element’s properties except unicode-bidi, direction, and CSS Custom Properties. It can set properties to their initial or inherited values, or to the values specified in another stylesheet origin.

Note:

for simplicity, we do not use any specific class for styling. That means, on a project you would not apply this on all buttons, you will apply it to the element it's needed.

Do you have any project in mind?

Let's turn your ideas into something great.

Whether you're a business owner, entrepreneur, an organisation, Institution, or individual, I'm here to help you bring your ideas or projects to life. As a consultant, I offer expert guidance and support to help you turn your project into a reality. I'll work with you every step of the way to ensure your project is a success.

Arrange a consultation