[주요 내용]
- 박스에 음영을 넣어서 테두리를 만들어주는 방법이 있음.
- css로 활용
- box-shadow: 0px 0px 3px 0px black;
- mycards라는 div 안에 card가 여러장 있을때 한번에 간격을 조절할 수 있음
.mycards > .card {
margin-top: 20px;
}
- 박스 안에 버튼은 아래와 같은 방법으로 간격 조절해야 함
.mypost > button{
margin-top: 15px
}
- 타이틀 텍스트를 가운데로 정렬하는 방법
/디스플레이를 유연하게 함/
display: flex;
/텍스트 가운데로 배치 = text-align/
flex-direction: column;
/내용물을 정가운데로 배치 = padding : 00px 대체 가능/
justify-content: center;
align-items: center;
- 타이틀 백그라운드 약간 어둡게 음영처리
- background-image: linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("주소");
[코딩 보기]
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
crossorigin="anonymous"></script>
<title>스파르타코딩클럽 | 부트스트랩 연습하기</title>
<link href="https://fonts.googleapis.com/css2?family=Jua&display=swap" rel="stylesheet">
<style>
* {
font-family: 'Jua', sans-serif;
}
.mytitle {
width: 100%;
height: 300px;
background-color: green;
color: white;
text-align: center;
background-image: linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url("http://www.igoodnews.net/news/photo/201801/55439_37497_1145.jpg");
background-size : cover;
background-position: center;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.mypost {
width: 500px;
margin: 20px auto 20px auto;
box-shadow: 0px 0px 3px 0px black;
padding: 20px;
}
.mypost > button{
margin-top: 15px
}
.mycards {
width: 500px;
margin: auto;
}
.mycards > .card {
margin-top: 20px;
}
</style>
</head>
<body>
<div>
<div class="mytitle">
<h1>성경 리딩 코멘트</h1>
</div>
<div class="mycards">
<div class="mypost">
<div class="form-floating mb-3">
<input type="text" class="form-control" id="name" placeholder="url">
<label for="floatingInput">성경구절</label>
</div>
<div class="form-floating">
<textarea class="form-control" placeholder="Leave a comment here" id="comment"
style="height: 100px"></textarea>
<label for="floatingTextarea2">성경 리딩 코멘트</label>
</div>
<button onclick="save_comment()" type="button" class="btn btn-dark">저장하기</button>
</div>
<div class="card">
<div class="card-body">
<blockquote class="blockquote mb-0">
<p>도가니는 은을 위하여, 풀무불은 금을 위하여, 이 세상은 사람의 마음을 위하여..</p>
<footer class="blockquote-footer">잠언 <cite title="Source Title">17:3</cite>
</footer>
</blockquote>
</div>
</div>
<div class="card">
<div class="card-body">
<blockquote class="blockquote mb-0">
<p>도가니는 은을 위하여, 풀무불은 금을 위하여, 이 세상은 사람의 마음을 위하여..</p>
<footer class="blockquote-footer">잠언 <cite title="Source Title">17:3</cite>
</footer>
</blockquote>
</div>
</div>
<div class="card">
<div class="card-body">
<blockquote class="blockquote mb-0">
<p>도가니는 은을 위하여, 풀무불은 금을 위하여, 이 세상은 사람의 마음을 위하여..</p>
<footer class="blockquote-footer">잠언 <cite title="Source Title">17:3</cite>
</footer>
</blockquote>
</div>
</div>
</div>
</body>
</html>