User:Wyn/Special Issue 26: Difference between revisions
No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
I learned that display determines how elements relate to each other in the document flow. The key values we covered were: | I learned that display determines how elements relate to each other in the document flow. The key values we covered were: | ||
<table bgcolor= | <table bgcolor=light-blue> | ||
<tr> | <tr> | ||
<th>display: block</th> | <th>display: block</th> | ||
Line 20: | Line 20: | ||
</table> | </table> | ||
- Elements only take up necessary space and flow within the text | - Elements only take up necessary space and flow within the text | ||
<table bgcolor= | <table bgcolor=light-blue> | ||
<tr> | <tr> | ||
<th>display: iinline-block</th> | <th>display: iinline-block</th> | ||
Line 27: | Line 27: | ||
- A hybrid that allows width/height settings while flowing inline | - A hybrid that allows width/height settings while flowing inline | ||
<table bgcolor= | <table bgcolor=light-blue> | ||
<tr> | <tr> | ||
<th>display: none</th> | <th>display: none</th> | ||
Line 64: | Line 64: | ||
align-items: center; | align-items: center; | ||
} | } | ||
.ear { | .ear { | ||
position: absolute; | position: absolute; | ||
Line 70: | Line 69: | ||
height: 40px; | height: 40px; | ||
} | } | ||
.eyebrow-group, .eye-group { | .eyebrow-group, .eye-group { | ||
display: flex; | display: flex; | ||
Line 76: | Line 74: | ||
width: 100%; | width: 100%; | ||
} | } | ||
</th> | </th> | ||
</tr> | </tr> | ||
</table> | </table> |
Revision as of 15:11, 15 February 2025
Study CSS like a linguist
Introduction to the core function of the CSS
In the CSS workshop, We learned the CSS properties like linguists, we explored two fundamental concepts: display and position properties. The display determines how elements interact with each other on a page; The position defines how elements are placed within their container.
We could choose the display and position group, focusing on the fundamental properties that how they work in the webpage.
I learned that display determines how elements relate to each other in the document flow. The key values we covered were:
display: block |
---|
- Elements take up the full width available and start on a new line;
display: inline |
---|
- Elements only take up necessary space and flow within the text
display: iinline-block |
---|
- A hybrid that allows width/height settings while flowing inline
display: none |
---|
- blank; Completely removes the element from view
The Position Property:
Position controls where elements are placed relative to other elements or the viewport. We explored:
position: relative - Elements can be offset from their normal position position: absolute - Elements are positioned relative to their nearest positioned ancestor position: fixed - Elements are positioned relative to the viewport
CSS drawing
The face metaphor fits the functions of display and position. To understand concepts, I created an interactive face using HTML and CSS. This project helped me visualize how display and position work together. The face became my canvas (like absolute positioning), with features like ears, eyes, and mouth representing different positioning scenarios. position: relative on the face container creates a positioning context for absolute-positioned elements (like the ears) display: flex helps arrange facial features in an organized way The combination of different display and position values creates complex layouts
The face metaphor helped me remember that:
The face itself (container) is like position: relative, providing a reference point Features like ears (position: absolute) need the face as their positioning context Eyes and eyebrows (display: flex) need to maintain their relationship with neighboring elements
face-container { position: relative; width: 400px; height: 500px; display: flex; flex-direction: column; align-items: center; } .ear { position: absolute; width: 30px; height: 40px; } .eyebrow-group, .eye-group { display: flex; justify-content: space-between; width: 100%; } |
---|