Apply class to css selector selects elements with a specific class attribute. To select elements with a specific class, write a period .) character, followed by the name of the class. You can also specify that only specific HTML elements should be affected by a class. 1 CSS exclude class 2 The CSS class selector matches elements based on the contents of their class attribute. /* All. 3 CSS exception 4 Standard specificity rules apply; in your example, since "first" and "second" have the same specificity, the rule declared later in the CSS will win. – Matt Bridges at Add a comment Yes, but not exactly with that ite,.something { display:inline }.composite,.else { background:red } Share Follow. 5 You can use CSS classes to group HTML elements and then apply custom styles to them. You can make classes and apply them to text, buttons, spans and divs, tables, images, or just about any other page element you can think of. Let’s now take a closer look at how we can use CSS classes to style page elements. How to Create a Class in CSS. 6 Prerequisites: Basic computer literacy, basic software installed, basic knowledge of working with files, HTML basics (study Introduction to HTML), and an idea of how CSS works (study CSS first steps.) Objective: To learn about the different CSS selectors we can use to apply CSS to a document. 7 Css all tags except 8 Long story short, I would like to tell the a attribute to apply to everything except img elements. 9 Add Class(es) to Adding Classes. 10 Classes are used by CSS and JavaScript to select and access specific elements The class attribute can be used on any HTML element The class name is case sensitive Different HTML elements can point to the same class name JavaScript can access elements with a specific class name with the getElementsByClassName () method HTML Exercises. 12