How to Select Elements by Attribute in CSS
An attribute selector picks elements by the value of one of their attributes. button[type="submit"] styles the submit button of a form and leaves every other button as it is.
CSS Styling, Custom Properties, Layout and Color Schemes
View All TagsAn attribute selector picks elements by the value of one of their attributes. button[type="submit"] styles the submit button of a form and leaves every other button as it is.
Teams has a light, a dark and a high contrast theme, and a web page inside Teams, in a tab or a dialog, has to look right in all of them. The page can ask Teams which theme is on with the Teams JavaScript library (TeamsJS), and pick its colors from the answer.
In Teams' dark theme, the web page in my agent's dialog was almost invisible: black text on Teams' dark grey dialog. The page never set a text color, and its background is transparent, so Teams' dark dialog showed through behind the browser's default black text.
A page can follow the light or dark setting of the visitor's computer without a line of JavaScript. Define each color once as a CSS variable, give the variables dark values inside a prefers-color-scheme media query, and use only the variables in the rest of your CSS. One more line, color-scheme, makes form fields and scroll bars follow too.