reading-notes

reading notes #5

Style and Presentation: CSS is used to control the visual appearance of web pages. It defines how elements are displayed, such as their colors, fonts, spacing, borders, and positioning.

Consistency: CSS allows for the centralization of style rules, making it easy to maintain a consistent look and feel across multiple pages of a website.

Separation of Content and Presentation: CSS promotes the separation of content and design. This means that you can change the layout and appearance of a web page without altering its underlying content, improving the flexibility and maintainability of web projects.

Three Ways to Insert CSS into Your Project:

Inline CSS: You can apply CSS directly to individual HTML elements using the style attribute. For example:

This is a red paragraph.

Internal (Embedded) CSS: include CSS rules within a style block in the <head> section of an HTML document. This CSS will apply to the entire page.

This is a red paragraph.

External CSS: I can create a separate CSS file (with a .css extension) and link it to my HTML documents using the element. For example:

HTML file (index.html):

This is a red paragraph.

CSS file (styles.css):

css code: p { color: red; } Example of a CSS Rule to Make All <p> Elements Red:

css code:

p { color: red; } This CSS rule will make the text color of all <p> elements within the HTML document red. It does so by selecting all <p> elements and setting their text color property (color) to the value “red.”