What is Internal CSS?
Internal CSS is defined within the <style> tags in the <head> section of an HTML document.
This allows you to define styles for the whole page without creating a separate CSS file.
Internal CSS is useful for smaller websites with a single page or when you want to apply unique styles to a single page.
CSS Colors
CSS supports various color formats: named colors, hexadecimal, RGB, and HSL.
The boxes above are styled using CSS with different background colors.
Text Styling
CSS can control text appearance, including font family, size, weight, and style.
This text uses a serif font.
This text uses a sans-serif font.
This text uses a monospace font.
Other text properties include:
- Font weight - controls text boldness
- Font style - controls if text is italic
- Text decoration - adds lines to text
- Text transform - controls capitalization
The CSS Box Model
Every HTML element is treated as a box with the following properties:
- Content: The actual content of the box
- Padding: Space between content and border
- Border: A visible or invisible line around the padding
- Margin: Space between the border and other elements
This box has padding, a border, and margin applied to it.