tanszek:oktatas:techcomm:cascading_style_sheets
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tanszek:oktatas:techcomm:cascading_style_sheets [2024/10/01 09:22] – [5. Selecting elements, classes and IDs] kissa | tanszek:oktatas:techcomm:cascading_style_sheets [2024/10/01 10:32] (current) – [3. Defining CSS styles] kissa | ||
---|---|---|---|
Line 90: | Line 90: | ||
<code CSS> | <code CSS> | ||
+ | /* styles.css */ | ||
p { | p { | ||
color: blue; | color: blue; | ||
Line 185: | Line 186: | ||
==== 6. Cascading ==== | ==== 6. Cascading ==== | ||
- | When multiple rules target the same selector, the later rule will override the previous one. | + | By default, when multiple rules target the same selector, the later rule will override the previous one: |
<code XML> | <code XML> | ||
Line 204: | Line 205: | ||
</ | </ | ||
- | ==== 7. Role of '' | + | ==== 7. Role of span and div elements ==== |
- | * '' | + | The **span** and **div** elements are fundamental components in HTML used for grouping and organizing content. They serve as containers that can be styled using CSS. |
- | * '' | + | |
+ | The '' | ||
+ | |||
+ | <code XML> | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | The '' | ||
<code XML> | <code XML> | ||
- | < | + | <div style=" |
- | <div style=" | + | <h1>Section Title</h1> |
- | <p>This is bold text.</p> | + | <p>This paragraph |
- | <p>So is this.</ | + | |
- | < | + | |
</ | </ | ||
</ | </ | ||
Line 220: | Line 226: | ||
==== 8. Background styling ==== | ==== 8. Background styling ==== | ||
- | The '' | + | Background styling in CSS allows developers to customize |
<code CSS> | <code CSS> | ||
Line 234: | Line 240: | ||
==== 9. Margin, padding and border ==== | ==== 9. Margin, padding and border ==== | ||
- | The '' | + | The **box model** |
{{: | {{: | ||
- | < | + | The '' |
- | div { | + | |
- | margin: 10px; | + | The example below shows how to format a button. Try what happens when you change the button' |
- | padding: 20px; | + | |
- | border: 1px solid black; | + | < |
- | border-radius: | + | < |
- | } | + | < |
+ | < | ||
+ | | ||
+ | < | ||
+ | .styled-button { | ||
+ | color: green; | ||
+ | background-color: | ||
+ | | ||
+ | padding: 20px; | ||
+ | border: 1px solid red; | ||
+ | border-radius: | ||
+ | } | ||
+ | </ | ||
+ | </ | ||
+ | < | ||
+ | < | ||
+ | <button class=" | ||
+ | < | ||
+ | </ | ||
+ | </ | ||
</ | </ | ||
Line 268: | Line 293: | ||
font-weight: | font-weight: | ||
font-style: italic; | font-style: italic; | ||
- | |||
text-decoration: | text-decoration: | ||
text-align: justify; | text-align: justify; | ||
} | } | ||
</ | </ | ||
+ | |||
+ | If you are interested, [[https:// | ||
==== 12. Exercise ==== | ==== 12. Exercise ==== | ||
- | Create the following webpage | + | Create the following webpage using HTML and CSS. Use embedded |
- | Feel free to use online resources (e.g. [[https:// | + | Feel free to use online resources (e.g. [[https:// |
{{: | {{: |
tanszek/oktatas/techcomm/cascading_style_sheets.1727774574.txt.gz · Last modified: 2024/10/01 09:22 by kissa