페이지 스타일 지정
시뮬레이션의 시각적 매력을 위해 몇 가지 스타일을 추가해 보겠습니다. styles.css 파일을 열고 다음 내용을 붙여넣습니다.
/* styles.css content
Stylesheet for a basic webpage layout:
- Sets a default light gray background, centered text alignment, and Arial font for the body.
- Styles for h2 and h3 headers with a specific blue color.
- Button styling includes:
- Blue background color with white text.
- Rounded corners.
- Hover effect to darken the background and slightly enlarge the button.
- #result is a styled container with padding, border, and shadow.
- Paragraphs have a top and bottom margin of 10px.
*/
body {
font-family: "Arial", sans-serif;
margin: 0;
padding: 0;
background-color: #f8f9fa;
color: #333;
text-align: center;
padding-top: 50px;
}
h2,
h3 {
color: #007bff;
}
button {
background-color: #007bff;
border: none;
color: white;
padding: 10px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
margin: 4px 2px;
cursor: pointer;
border-radius: 4px;
transition:
background-color 0.3s,
transform 0.3s;
}
button:hover {
background-color: #0056b3;
transform: scale(1.05);
}
#result {
margin-top: 20px;
padding: 20px;
border: 1px solid #e0e0e0;
background-color: #ffffff;
border-radius: 5px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
p {
margin: 10px 0;
}
styles.css 파일은 시뮬레이션의 시각적 측면을 정의하는 곳입니다.
-
Body Styles (본문 스타일):
font-family: "Arial", sans-serif;: 웹 페이지 본문의 기본 글꼴을 Arial 로 설정합니다. Arial 을 사용할 수 없는 경우, sans-serif 글꼴로 대체됩니다.
margin: 0; padding: 0;: 기본 여백과 안쪽 여백을 제거합니다.
background-color: #f8f9fa;: 전체 페이지에 밝은 회색 배경색을 설정합니다.
color: #333;: 텍스트에 어두운 회색 색상을 설정합니다.
text-align: center;: 페이지의 텍스트를 가운데 정렬합니다.
padding-top: 50px;: 본문 상단에 50px 의 안쪽 여백을 추가합니다.
-
Header Styles (헤더 스타일):
h2, h3 { color: #007bff; }: h2 및 h3 헤더는 특정 파란색 음영으로 색칠됩니다.
-
Button Styles (버튼 스타일):
- 버튼은 파란색 배경, 흰색 텍스트, 테두리 없음으로 설정됩니다.
border-radius를 사용하여 둥근 모서리를 제공합니다.
- 버튼 위에 마우스를 올리면 배경색이 더 어두운 파란색 음영으로 바뀌고 버튼이 약간 커집니다 (
transform: scale(1.05);).
-
Result Container (결과 컨테이너):
#result: "result"라는 id 를 가진 요소를 나타냅니다.
- 흰색 배경, 회색 테두리 및 미묘한 그림자가 있습니다.
- 컨테이너는 둥근 모서리가 있는 카드 또는 상자처럼 스타일이 지정됩니다.
-
Paragraph Styles (단락 스타일):
- 단락 (
p) 은 상단과 하단에 10px 의 여백을 갖습니다. 이렇게 하면 연속된 단락과 다른 요소 사이에 간격이 생깁니다.
이 단계는 사용자 인터페이스가 보기 좋고 읽기 쉽도록 보장합니다.