22title : CSS
33---
44
5+ import { Sandpack } from " @codesandbox/sandpack-react" ;
6+ import firstCssHtml from " !!raw-loader!./_samples/first-css/index.html" ;
7+ import redHelloWorldHtml from " !!raw-loader!./_samples/red-hello-world/index.html" ;
8+ import redHelloWorldCss from " !!raw-loader!./_samples/red-hello-world/style.css" ;
9+ import yellowHelloCssHtml from " !!raw-loader!./_samples/yellow-hello-css/index.html" ;
10+ import yellowHelloCssCss from " !!raw-loader!./_samples/yellow-hello-css/style.css" ;
11+ import fooHtml from " !!raw-loader!./_samples/foo/index.html" ;
12+
513この節では、Web開発で用いられるもう一つの言語である、CSSについて学びます。CSSはWebサイトの「見た目」をつかさどる言語です。多くの<Term >HTML要素</Term >は、<Term >CSS</Term >を用いることで、その見た目を細かくカスタマイズすることができます。
614
715![ Web開発で用いられる言語] ( ../02-html/web-development-languages.drawio.svg )
@@ -15,7 +23,15 @@ title: CSS
1523<div style =" color : red ; font-size : 24px ;" >Hello World!</div >
1624```
1725
18- <ViewSource url = { import .meta .url } path = " _samples/first-css" />
26+ <Sandpack
27+ template = " static"
28+ files = { {
29+ " /index.html" : firstCssHtml ,
30+ }}
31+ options = { {
32+ activeFile: " /index.html" ,
33+ }}
34+ />
1935
2036![ Hello World!] ( ./red-hello-world.png )
2137
@@ -60,7 +76,16 @@ title: CSS
6076}
6177```
6278
63- <ViewSource url = { import .meta .url } path = " _samples/red-hello-world" />
79+ <Sandpack
80+ template = " static"
81+ files = { {
82+ " /index.html" : redHelloWorldHtml ,
83+ " /style.css" : redHelloWorldCss ,
84+ }}
85+ options = { {
86+ activeFile: " /index.html" ,
87+ }}
88+ />
6489
6590### ` link ` 要素
6691
@@ -127,7 +152,16 @@ HTMLファイルとCSSファイルを分けて作成する場合、`style`属性
127152
128153</Answer >
129154
130- <ViewSource url = { import .meta .url } path = " _samples/yellow-hello-css" />
155+ <Sandpack
156+ template = " static"
157+ files = { {
158+ " /index.html" : yellowHelloCssHtml ,
159+ " /style.css" : yellowHelloCssCss ,
160+ }}
161+ options = { {
162+ activeFile: " /index.html" ,
163+ }}
164+ />
131165
132166## 演習問題2
133167
@@ -183,6 +217,14 @@ HTMLファイルとCSSファイルを分けて作成する場合、`style`属性
183217}
184218```
185219
186- <ViewSource url = { import .meta .url } path = " _samples/foo" />
220+ <Sandpack
221+ template = " static"
222+ files = { {
223+ " /index.html" : fooHtml ,
224+ }}
225+ options = { {
226+ activeFile: " /index.html" ,
227+ }}
228+ />
187229
188230</Answer >
0 commit comments