Top 10 basic CSS commands
In this top 10, I’ll cover the essential CSS commands that are frequently used by web developers to style and design web pages.
2. Class: allows you to group elements that share the same class and apply styles to them. Classes are defined in HTML with the “class” attribute. For example, to apply a style to all elements with the “highlight” class, use the class selector “.highlight”.
3. ID: similar to a class, but is unique to a single element. IDs are defined in HTML with the “id” attribute. For example, to apply a style to an element with the ID “header”, use the ID selector “#header”.
4. Color property: allows you to define the background or text color of an element. Colors can be specified in different formats, such as color name, hexadecimal code, RGB, among others.
5. Font property: allows you to define the font and size of an element’s text.
领英推荐
6. Margin and padding property: allows you to add space around or inside an element.
7. Width and height property: allows you to define the width and height of an element.
8. Display property: allows you to control how an element is displayed on the page. For example, “block” to display the element on a new line or “inline” to display the element in the text flow.
9. Position property: allows you to define the position of an element on the page. For example, “absolute” to position the element relative to the parent element or “fixed” to fix the element on the screen.
10. Border property: allows you to add a border around an element.