Example code of how CSS matches multiple classes

Example code of how CSS matches multiple classes

CSS matches multiple classes

The following HTML tag li, class has open style. My requirement is to change the background color to white only when open and active exist at the same time

<li id="menu_268098" title="Account Information Query" class="open">
        <li id="menu_270008" class="nav_sec" title="Account Balance Query">
            <a href="#/p/payment.search.account_balance" class="dropdown-toggle">
                <span class="nav-title">Account Balance Inquiry</span>
            </a>
        </li>
    </ul>
</li>
<li id="menu_268098" title="Account Information Query" class="open active">
        <li id="menu_270008" class="nav_sec" title="Account Balance Query">
            <a href="#/p/payment.search.account_balance" class="dropdown-toggle">
                <span class="nav-title">Account Balance Inquiry</span>
            </a>
        </li>
    </ul>
</li>

The css can be written like this:

li.open.active{
  background-color: #fff;
}

Note: There should be no space between .open.active

Summarize

This is the end of this article about how to match multiple classes in CSS. For more information about how to match multiple classes in CSS, please search previous articles on 123WORDPRESS.COM or continue to browse the related articles below. I hope you will support 123WORDPRESS.COM in the future!

<<:  Fixed table width table-layout: fixed

>>:  5 Reasons Why Responsive Web Design Isn’t Worth It

Recommend

MySQL Practical Experience of Using Insert Statement

Table of contents 1. Several syntaxes of Insert 1...

Use of LRU algorithm in Vue built-in component keep-alive

Table of contents The use of Vue's keep-alive...

Summary of 10 amazing tricks of Element-UI

Table of contents el-scrollbar scroll bar el-uplo...

Understanding v-bind in vue

Table of contents 1. Analysis of key source code ...

CSS example code to hide the scroll bar and scroll the content

Preface When the HTML structure of a page contain...

Detailed explanation of how to detect and prevent JavaScript infinite loops

Table of contents Preface Fix infinite loop in fo...

How to add shortcut commands in Xshell

As a useful terminal emulator, Xshell is often us...

Introduction to Linux system swap space

Swap space is a common aspect of computing today,...

Detailed explanation of Linux mpstat command usage

1. mpstat command 1.1 Command Format mpstat [ -A ...

Detailed explanation of several ways to install CMake on Ubuntu

apt install CMake sudo apt install cmake This met...

JavaScript programming through Matlab centroid algorithm positioning learning

Table of contents Matlab Centroid Algorithm As a ...

MySQL 8.0.25 installation and configuration tutorial under Linux

The latest tutorial for installing MySQL 8.0.25 o...