CSS Core Properties
Understanding CSS core properties is crucial for designing and styling web pages effectively. Below are some of the key properties with detailed explanations and examples.
1. CSS Color
CSS color properties allow you to set the color of text and elements.
- color: Sets the color of text.
2. CSS Backgrounds
CSS background properties are used to define the background effects for elements.
- background-color: Sets the background color.
- background-image: Sets the background image.
- background-repeat: Defines if/how a background image will repeat.
- background-position: Sets the starting position of the background image.
- background-size: Specifies the size of the background image.
3. CSS Box Model
The CSS Box Model describes the rectangular boxes generated for elements in the document tree and consists of margins, borders, padding, and the actual content.
- width and height: Set the width and height of the content area.
- padding: Space between the content and the border.
- border: A line around the padding and content.
- margin: Space outside the border.
4. CSS Borders
CSS border properties allow you to specify the style, width, and color of an element's border.
- border: Shorthand for setting border width, style, and color.
- border-radius: Rounds the corners of an element's outer border edge.
5. CSS Margins
Margins create space around elements, outside of any defined borders.
- margin: Shorthand property for setting the margin on all four sides.
- margin-top, margin-right, margin-bottom, margin-left: Set the margin for individual sides.
6. CSS Padding
Padding creates space around the content, inside of any defined borders.
- padding: Shorthand property for setting the padding on all four sides.
- padding-top, padding-right, padding-bottom, padding-left: Set the padding for individual sides.
7. CSS Box Sizing
The box-sizing property allows you to define how the width and height of an element are calculated: should they include padding and borders, or not.
- content-box: Default. The width and height properties include only the content. Border and padding are not included.
- border-box: The width and height properties include content, padding, and borders.
No comments:
Post a Comment