-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,459 additions
and
12 deletions.
There are no files selected for viewing
520 changes: 520 additions & 0 deletions
520
docs/.vitepress/config.mts.timestamp-1727180472816-91aab5020cbf.mjs
Large diffs are not rendered by default.
Oops, something went wrong.
520 changes: 520 additions & 0 deletions
520
docs/.vitepress/config.mts.timestamp-1727180708945-e6fd69ef2ddb5.mjs
Large diffs are not rendered by default.
Oops, something went wrong.
167 changes: 167 additions & 0 deletions
167
...document/HTML & CSS/docs/1. Web Development Fundamentals/CSS/1. Style target.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
# Style Selector | ||
|
||
## Class selector | ||
|
||
Use `.` to select a element with class. | ||
|
||
Synopsis: `[<parent_pattern>].<class_name>{}` | ||
|
||
```css | ||
.class_name { | ||
|
||
} | ||
/* matches to all paragraph with the class */ | ||
p.class_name { | ||
|
||
} | ||
``` | ||
|
||
> [!WARNING] | ||
> Space matters in selector. | ||
> See: [Recusive child selector](#Recusive-child-selector) | ||
```css | ||
/* matches recursive children with class `foo` after a paragraph */ | ||
p .foo { | ||
|
||
} | ||
/* matches paragraph with class `foo` */ | ||
p.foo { | ||
|
||
} | ||
``` | ||
|
||
## Attribute selector | ||
|
||
```css | ||
/* matches to all element have `href` attribute */ | ||
[href] { | ||
color: blue; | ||
} | ||
/* matches to all anchors have `href` attribute */ | ||
a[href] { | ||
color: blue; | ||
} | ||
``` | ||
### Exact match | ||
|
||
```css | ||
/* matches all anchors have the exact value */ | ||
a[href="foo.com"] { | ||
} | ||
``` | ||
|
||
### Contains operator | ||
|
||
```css | ||
/* matches all anchors contains the value */ | ||
a[href*="foo"] { | ||
color: blue; | ||
} | ||
``` | ||
|
||
### Starts-with operator | ||
|
||
```css | ||
/* matches all anchors starts with the value */ | ||
a[href^="https"] { | ||
color: blue; | ||
} | ||
``` | ||
|
||
### Ends-with operator | ||
|
||
```css | ||
/* matches all anchors ends with the value */ | ||
a[href$=".com"] { | ||
color: blue; | ||
} | ||
``` | ||
|
||
### Operator composition | ||
|
||
One can combine different patterns: | ||
|
||
```css | ||
[href$=".com"][href^="https"] { | ||
|
||
} | ||
``` | ||
## Relational selector | ||
|
||
> [!TIP] | ||
> Use `*` to represent an all pattern | ||
### Recusive child selector | ||
|
||
Use a space to represent recursive child selection. | ||
|
||
Synopsis: `<parent_pattern> <child_pattern> {}` | ||
|
||
```css | ||
/* matches to all anchors of paragraph recursively */ | ||
p a { | ||
|
||
} | ||
``` | ||
|
||
### Direct child selector | ||
|
||
Use `>` to represent direct child selection. | ||
|
||
Synopsis: `<parent_pattern> > <child_pattern> {}` | ||
|
||
```css | ||
/* matches to all first level anchors under a paragraph recursively */ | ||
p > a { | ||
|
||
} | ||
``` | ||
|
||
### Adjacent sibling selector | ||
|
||
Use `+` to represent a direct neighbor of certain pattern. | ||
|
||
Synopsis: `<parent_pattern> + <child_pattern> {}` | ||
|
||
```css | ||
/* matches a achor right after paragraph */ | ||
p + a { | ||
|
||
} | ||
``` | ||
|
||
```html | ||
<p>foo</p> | ||
<a></a> <!-- matched! --> <!-- [!code highlight] --> | ||
<a></a> <!-- not matched --> <!-- [!code error] --> | ||
``` | ||
|
||
### General sibling selector | ||
|
||
Use `~` to represent a direct neighbor of certain pattern. | ||
|
||
Synopsis: `<parent_pattern> ~ <child_pattern> {}` | ||
|
||
```css | ||
/* matches all achors right after paragraph */ | ||
p ~ a { | ||
|
||
} | ||
``` | ||
|
||
```html | ||
<p>foo</p> | ||
<a></a> <!-- matched! --> <!-- [!code highlight] --> | ||
<a></a> <!-- matched! --> <!-- [!code highlight] --> | ||
``` | ||
|
||
## Pseudo class | ||
|
||
Pseudo classes are some built in pattern from css for selecting in some trivial scenarios. | ||
Pseudo classes starts with `:`, can be used as a single pattern too just like `.` | ||
|
||
### First/Last child | ||
|
||
- `:first-child`: selects first child of a parent, it's surely a **first** version of `>` | ||
- `:first-of-type`: selects first children of a parent having the distinct tag name. |
138 changes: 138 additions & 0 deletions
138
...ocument/HTML & CSS/docs/1. Web Development Fundamentals/HTML/Common Elements.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
# | ||
|
||
## Anchor(Hyperlink) | ||
|
||
- Normal hyperlink | ||
- `<a href="https://www.foo.com"></a>{:html}` | ||
- Downloadable hyperlink | ||
- `<a href="https://www.foo.com/bar.jpg" download></a>{:html}` | ||
- `<a href="https://www.foo.com/bar/" download></a>{:html}` | ||
|
||
> [!IMPORTANT] | ||
> Must specify a protocol for external links. | ||
- Jump to section | ||
- `<a href="#<element_id>">foo</a>{:html}` | ||
- `<a href="#">foo</a>{:html}`: jump to top | ||
|
||
- `<a href="emailto:[email protected]">Email Me!</a>{:html}` | ||
|
||
## Video & Audio | ||
|
||
- Auto play video | ||
- `<video autoplay src="./foo.mp4"></video>{:html}` | ||
- With controls | ||
- `<video controls src="./foo.mp4"></video>{:html}` | ||
- Looping play | ||
- `<video loop src="./foo.mp4"></video>{:html}` | ||
- Providing message if client doesn't support `<video>` | ||
- `<video src="./foo.mp4">Video not supported in your broswer</video>{:html}` | ||
|
||
> [!NOTE] | ||
> Same for `<audio>` | ||
## List & Table | ||
|
||
List and Table are groups of related elements commonly used together. | ||
|
||
### List elements | ||
- `<ul>`: unordered list | ||
- `<ol>`: ordered list | ||
- `<li>`: list item | ||
- `<dl>`: description list | ||
- `<dt>`: description term | ||
- `<dd>`: description detail | ||
|
||
`<li>` in `<ol>` is ordered, while in `<ul>` is not. | ||
|
||
```html | ||
<body> | ||
<ul> | ||
<li>foo</li> <!-- [!code highlight] --> | ||
<li>bar</li> <!-- [!code highlight] --> | ||
<li> | ||
<ol> | ||
<li>1</li> <!-- [!code highlight] --> | ||
<li>2</li> <!-- [!code highlight] --> | ||
<li>3</li> <!-- [!code highlight] --> | ||
</ol> | ||
</li> | ||
</ul> | ||
</body> | ||
``` | ||
|
||
`<dl>` is kind a list of pair of content to be described and the description content. | ||
|
||
```html | ||
<body> | ||
<dl> | ||
<dt>foo</dt> | ||
<dd>I am foo</dd> | ||
<!-- like a pair --> | ||
<dt>bar</dt> | ||
<dd>I am bar</dd> | ||
</dl> | ||
</body> | ||
``` | ||
|
||
### Table | ||
|
||
- `<table>` | ||
- `<th>`: table header | ||
- `<tr>`: table row | ||
- `<td>`: table data | ||
- other `<td>`... | ||
- `<thead>`: head of table, just for grouping | ||
- `<tbody>`: data body of table, just for grouping | ||
- `<tfoot>`: table footer, can be used for data aggregation like sum of the values | ||
|
||
```html | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>name</th> | ||
<th>age</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>John</td> | ||
<td>18</td> | ||
</tr> | ||
<tr> | ||
<td>Jane</td> | ||
<td>18</td> | ||
</tr> | ||
</tbody> | ||
<tfoot> | ||
<tr> | ||
<th>Row Count</th> | ||
<th>2</th> | ||
</tr> | ||
</tfoot> | ||
</table> | ||
``` | ||
|
||
Should be equivalent to(besides the style): | ||
| name | age | | ||
| -------------- | --------------- | | ||
| John | 18 | | ||
| Jane | 18 | | ||
|Row Count|2| | ||
|
||
## Container elements | ||
|
||
### Div | ||
|
||
### Span | ||
|
||
### Article & Figure | ||
|
||
- `<article>` | ||
- `<figure>`: a wrapper for image | ||
- `<img>`: image contained | ||
- `<figcaption>`: description for the image | ||
- `<p>`: just for normal paragraph | ||
- `<mark>`: mark the content with light yellow background by default | ||
- `<time>`: mark a time, useful for SEO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.