How can you ensure cross-browser compatibility when using CSS selectors?

Cross-browser compatibility can be ensured when using CSS selectors by testing the selectors in different browsers and making adjustments as needed. It is important to use widely supported CSS selectors and properties to minimize compatibility issues. Additionally, using a CSS reset or normalization stylesheet can help create a consistent baseline across browsers.

<style>
/* Reset or normalize CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Example of using widely supported CSS selectors */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Adjusting selectors as needed */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .container {
        display: -webkit-box;
        -webkit-box-pack: center;
        -webkit-box-align: center;
    }
}
</style>