就像在 HTML 中一樣,你可以在元件中加入 <style>
標籤。讓我們為 <p>
元素添加一些樣式
App
<p>This is a paragraph.</p>
<style>
p {
color: goldenrod;
font-family: 'Comic Sans MS', cursive;
font-size: 2em;
}
</style>
重要的是,這些規則是限定在元件範圍內的。你不會意外地更改應用程式中其他地方的 <p>
元素的樣式,我們將在下一步看到這一點。
1
2
3
4
5
6
<p>This is a paragraph.</p>
<style>
/* Write your CSS here */
</style>