[w3schools] HTML Exercises - Styles

Ditto·2021년 5월 5일
0

HTML Styles

1. Use the correct HTML attribute, and CSS, to set the color of the paragraph to "blue".

<p style="color:blue;">This is a paragraph.</p>

This is a paragraph.

style 속성을 통해 css를 정의할 수 있다. 그러나 일반적으로 스타일은 외부 스타일 시트에 작성하고 link 요소로 연결하는 편이 좋다.


2. Use CSS to set the font of the paragraph to "courier".

<p style="font-family:courier;">This is a paragraph.</p>

This is a paragraph.

style 속성을 통해 font-family를 각 태그에 설정해 줄 수 있다.


3. Use CSS to center align the paragraph.

<p style="text-align:center;">This is a paragraph.</p>

This is a paragraph.

style 속성을 통해 text-align을 각 태그에 설정해 줄 수 있다.


4. Use CSS to set the text size to 50 pixels.

<p style="font-size:50px;">This is a paragraph.</p>

This is a paragraph.

style 속성을 통해 font-size를 각 태그에 설정해 줄 수 있다.


5. Use CSS to set the background-color of the document to yellow.

<html>
<body style="background-color:yellow;">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>

This is a heading

This is a paragraph.

현재 벨로그에서는 확인되지 않지만 body에 style 속성을 지정하여 배경색을 바꿀 수 있다.


6. Use CSS to center align the document.

<html>
<body style="text-align:center;">
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>

This is a heading

This is a paragraph.

현재 벨로그에서는 확인되지 않지만 body에 style 속성을 지정하여 하위 element의 text-align을 지정할 수 있다.

profile
늘 성장하는 개발자이고 싶습니다

0개의 댓글