์์ฆ ์ฌ์ดํธ UI ๋ฅผ ์ดํด๋ณด๋ ์ด๋ ๊ฒ ์์๋๋ก ๋ท๋ฐฐ๊ฒฝ ์์ ๋ค๋ฅด๊ฒ ํ๋ค, ๊ทธ ์์ด ๊ตฌ๋ถ๋๋ ์ ์์ ์นด๋ UI๋ฅผ ์์น์์ผ์ ์๋์ ๊ฐ์ ์ผ์ข ์ "๋ถํ ๋ฐฐ๊ฒฝ" ๋๋ "๊ตฌ๋ถ์ ์นด๋ UI" ๋์์ธ์ ์์ฃผ ์ฌ์ฉํ๋๊ฒ์ ์ ์ ์์๋ค.
chatgpt ๋ฅผ ์ฌ์ฉํ์ฌ ๋ง๋ค์ด๋ณด์.
์ ์ ์ฝ๋ ๊ฒฐ๊ณผ๋ฅผ ์์๋ด๊ธฐ ์ํ ์ง๋ฌธ ๊ณผ์ ์ด์์ต๋๋ค.
1. ๋ค์ ๋ฐฐ๊ฒฝ์ 2:8 ๋น์จ๋ก ๋ฐฐ๊ฒฝ์์ ๋๋๊ณ ๊ทธ ์์ ์นด๋ํ UI๋ก ๋ฐ์ฐ๊ณ ์ถ์ต๋๋ค.
2. ์ ์๋๋ก ๋ฐฐ๊ฒฝ์์ ๋๋์ธ์
3. ๋ท ๋ฐฐ๊ฒฝ ๋๋ ์ง๋ ๋ถ๋ถ์ ์นด๋๋ฅผ ์์น์์ผ์ฃผ์ธ์.
4. ๋ท ๋ฐฐ๊ฒฝ์ ์์๋๋ก ๋๋๊ณ , ๋๋ ์ง๋ ์ ์์ ์นด๋๋ฅผ ๋ฐฐ์น์์ผ์ฃผ์ธ์.
5. ๊ทธ์น๋ง ์์ง ์ ๊ฐ ์ํ๋๋๋ก ๋์ง ์์์ต๋๋ค. ์นด๋ ๋ฅผ ๋งจ ์์ผ๋ก ์์น์์ผ์ ์นด๋ ๋ค์ ๋ฐฐ๊ฒฝ์ด ๋์ค๋๋ก ํด์ฃผ์ธ์
๊ฒฐ๊ณผ
์ฝ๋
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>๊ณต์ง์ฌํญ ์์ </title>
<link rel="stylesheet" href="/css/styles.css">
<link rel="stylesheet" href="/css/notice/notice-edit.css">
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.startbootstrap.com/sb-forms-latest.js"></script>
<!-- CSRF ๋ก ์ธํ 403 ์๋ฌ ๋ฌธ์ ํด๊ฒฐ -->
<meta name="_csrf" th:content="${_csrf.token}"/>
<meta name="_csrf_header" th:content="${_csrf.headerName}"/>
<style>
/* ๋ฐฐ๊ฒฝ์ ์ ์๋๋ก ๋๋๊ณ ์นด๋๋ฅผ ๋งจ ์์ผ๋ก ์์น์ํค๋ ์คํ์ผ */
.container {
position: relative;
width: 100%;
height: 100vh;
overflow: hidden;
}
.background {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.top-bg, .bottom-bg {
flex: 1;
}
.card-wrapper {
position: relative;
z-index: 1; /* ์นด๋๋ฅผ ๋งจ ์์ผ๋ก ์์น์ํด */
display: flex;
justify-content: center;
align-items: center;
height: 100%;
}
.card {
width: 80%;
padding: 20px;
background-color: white;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<div class="container">
<div class="background">
<div class="top-bg" style="background-color: #E9ECEF;">
<!-- ์์ชฝ ๋ฐฐ๊ฒฝ์ -->
</div>
<div class="bottom-bg" style="background-color: #F8F9FA;">
<!-- ์๋์ชฝ ๋ฐฐ๊ฒฝ์ -->
</div>
</div>
<div class="card-wrapper">
<div class="card">
<!-- ์์ ํ ๋ด์ฉ ์
๋ ฅ ํผ -->
<h2>๊ณต์ง์ฌํญ ์์ </h2>
<form id="editNoticeForm">
<div class="mb-3">
<label for="title" class="form-label">์ ๋ชฉ</label>
<input type="text" class="form-control" id="title" name="title" th:value="${notice.title}" required>
</div>
<div class="mb-3">
<label for="content" class="form-label">๋ด์ฉ</label>
<textarea class="form-control" id="content" name="content" rows="5" th:text="${notice.content}" required></textarea>
</div>
<input type="hidden" id="noticeId" name="noticeId" th:value="${notice.id}">
<button type="button" class="btn btn-primary" onclick="submitEditNotice()">์์ </button>
</form>
</div>
</div>
</div>
</body>
</html>
์ ์ฝ๋์์๋ .container ํด๋์ค๋ฅผ ์ฌ์ฉํ์ฌ ์ ์ฒด ๋ฐฐ๊ฒฝ์ ๊ฐ์ธ๊ณ , ๋ฐฐ๊ฒฝ์ ์ ์๋๋ก ๋๋๋ .background ํด๋์ค๋ฅผ ์ถ๊ฐํ์ต๋๋ค. ์นด๋๋ฅผ ๋งจ ์์ผ๋ก ์์น์ํค๊ธฐ ์ํด ์นด๋๋ฅผ ๊ฐ์ธ๋ .card-wrapper ํด๋์ค์ z-index: 1; ์์ฑ์ ์ถ๊ฐํ์ต๋๋ค. ์ด๋ ๊ฒ ํ๋ฉด ์นด๋๊ฐ ๋ฐฐ๊ฒฝ ์์ ํ์๋ฉ๋๋ค.
๋น์จ์ ์์ ํ๊ณ ์ถ๋ค๋ฉด!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>๊ณต์ง์ฌํญ ์์ </title>
<link rel="stylesheet" href="/css/styles.css">
<link rel="stylesheet" href="/css/notice/notice-edit.css">
<!-- Bootstrap core JS-->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://cdn.startbootstrap.com/sb-forms-latest.js"></script>
<!-- CSRF ๋ก ์ธํ 403 ์๋ฌ ๋ฌธ์ ํด๊ฒฐ -->
<meta name="_csrf" th:content="${_csrf.token}"/>
<meta name="_csrf_header" th:content="${_csrf.headerName}"/>
<style>
/* ๋ฐฐ๊ฒฝ์ ์ ์๋๋ก ๋๋๊ณ ์นด๋๋ฅผ ๋งจ ์์ผ๋ก ์์น์ํค๋ ์คํ์ผ */
.container {
position: relative;
width: 100%;
height: 100vh;
overflow: hidden;
}
.background {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
display: flex;
flex-direction: column;
}
.top-bg, .bottom-bg {
flex: 2; /* ์ ์๋ ๋ฐฐ๊ฒฝ ๋น์จ ์กฐ์ */
}
.bottom-bg {
flex: 7; /* ์ ์๋ ๋ฐฐ๊ฒฝ ๋น์จ ์กฐ์ */
}
.card-wrapper {
position: relative;
z-index: 1; /* ์นด๋๋ฅผ ๋ท๋ฐฐ๊ฒฝ ๊ตฌ๋ถ์ ์๋ก ์์น์ํด */
display: flex;
justify-content: center;
align-items: center;
height: 50%;
}
.card {
width: 80%;
padding: 20px;
background-color: white;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
</style>
</head>
<body>
<div class="container">
<div class="background">
<div class="top-bg" style="background-color: #E9ECEF;">
<!-- ์์ชฝ ๋ฐฐ๊ฒฝ์ -->
</div>
<div class="bottom-bg" style="background-color: #F8F9FA;">
<!-- ์๋์ชฝ ๋ฐฐ๊ฒฝ์ -->
</div>
</div>
<div class="card-wrapper">
<div class="card">
<!-- ์์ ํ ๋ด์ฉ ์
๋ ฅ ํผ -->
<h2>๊ณต์ง์ฌํญ ์์ </h2>
<form id="editNoticeForm">
<div class="mb-3">
<label for="title" class="form-label">์ ๋ชฉ</label>
<input type="text" class="form-control" id="title" name="title" th:value="${notice.title}" required>
</div>
<div class="mb-3">
<label for="content" class="form-label">๋ด์ฉ</label>
<textarea class="form-control" id="content" name="content" rows="5" th:text="${notice.content}" required></textarea>
</div>
<input type="hidden" id="noticeId" name="noticeId" th:value="${notice.id}">
<button type="button" class="btn btn-primary" onclick="submitEditNotice()">์์ </button>
</form>
</div>
</div>
</div>
</body>
</html>
์ด 3๋ถ๋ถ์ ์กฐ๊ธ์ฉ ์์ ํ์ฌ ํ์ธํด๋ณด์ธ์.
์ ์ฝ๋๋ฅผ ๋ณต์ฌํด์
https://www.w3schools.com/css/tryit.asp?filename=trycss_editor
W3Schools online HTML editor
The W3Schools online code editor allows you to edit code and view the result in your browser
www.w3schools.com
์ฌ๊ธฐ์ ์ฝ๋ ๋ถ๋ถ์ ๋ถ์ฌ๋ฃ์ด์ ์คํ์์ผ๋ณด์ธ์. ๋น ๋ฅด๊ณ ๊ฐํธํ๊ฒ ์คํ๊ฒฐ๊ณผ๋ฅผ ํ์ธํด ๋ณผ ์ ์์ต๋๋ค.
'HTML + CSS ์๋ฆฌ์ฆ๐ธ' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๊ฐ๋จํ ๋ก๊ทธ์ธ ํ์ด์ง _ HTML (3) | 2022.11.20 |
---|