Nothing is for sale here. Freewill tips keep the site running. Want to help? → Tip via Paypal
Generic CSS Classes
CSS allows you to create your own generic style classes. A generic class is simply a style rule that is not associated with a specific selector (CSS selector = HTML element).It can be applied by adding the class name to a qualified selector. A qualified selector is any HTML element where it’s legal to use the style rules assigned by the generic class.
To create a generic rule, simply add a period and a class name to your embedded or external style sheet. For example:
By creating that rule, anytime we add class="border" to a qualified element, that element will have a solid black 1 pixel border around it and 5 pixels of padding within the element.
Here’s an example of how to add that class to a division tag:
Here’s what that class would look like:
OK, I cheated . . . I slipped in a background color and changed the font. Hey, you have to watch me, sometimes I’m a wild and crazy guy like that, even if I am an old coot!