목차
Modal 예제 - 기본
Modal 예제 - 크기 조정
Modal 예제 - 기본
<!DOCTYPE html>
<html lang="ko">
<head>
<title>Bootstrap 예제</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>
<div class="container">
<h2>Modal 예제</h2>
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#hzModal " >
홈짱닷컴 주소보기
</button>
<div class="modal fade " id="hzModal " >
<div class="modal-dialog modal-sm modal-dialog-centered modal-dialog-scrollable " >
<div class="modal-content" >
<div class="modal-header" >
<h4 class="modal-title" >홈짱닷컴 주소</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body" >
Homzzang.com
</div>
<div class="modal-footer" >
<button type="button" class="btn btn-danger" data-dismiss="modal" >닫기</button>
</div>
</div><!--modal-content-->
</div><!--modal-dialog-->
</div><!--modal-->
</div><!--container-->
</body>
</html>
결과보기
[modal 클래스 옆]
※ fade 클래스 : 페이드효과추가.
[modal-dialog 클래스 옆]
※ modal-sm 클래스 : 소형모달창
※ 크기 클래스 없으면 중간모달창
※ modal-lg 클래스 : 대형모달창
※ modal-xl 클래스 : 초대형모달창
※ modal-dialog-centered : 화면정중앙
※ modal-dialog-scrollable : 모달창스크롤 (※ 이 클래스가 없으면 모달창 외부에 스크롤바 생김)
예제보기
Modal 예제 - 크기 조정
<div class="container">
<h1 class="display-4 text-center mb-4">BS Modal</h1>
<div class="row mb-4">
<div class="col text-center">
<h3>Basic Modal </h3>
<a href="#" class="btn btn-lg btn-success" data-toggle="modal" data-target="#basicModal ">클릭</a>
</div>
</div>
<div class="row mb-4">
<div class="col text-center">
<h3>Large Modal </h3>
<a href="#" class="btn btn-lg btn-primary" data-toggle="modal" data-target="#largeModal ">클릭</a>
</div>
</div>
<div class="row">
<div class="col text-center">
<h3>Small Modal </h3>
<a href="#" class="btn btn-lg btn-danger" data-toggle="modal" data-target="#smallModal ">클릭</a>
</div>
</div>
</div>
<!-- basic modal -->
<div class="modal fade" id="basicModal " tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Basic Modal</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<h3>Modal Body</h3>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
</div>
</div>
</div>
</div>
<!-- large modal -->
<div class="modal fade" id="largeModal " tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Large Modal</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<h3>Modal Body</h3>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
</div>
</div>
</div>
</div>
<!-- small modal -->
<div class="modal fade" id="smallModal " tabindex="-1" role="dialog" aria-labelledby="basicModal" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myModalLabel">Small Modal</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<h3>Modal Body</h3>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">닫기</button>
</div>
</div>
</div>
</div>
예제보기
주소 복사
랜덤 이동