본문 바로가기
프로그램

alert message box(간단한 경고 메세지 박스)

by 바람사이 2021. 12. 30.

간단한 경고 메세지 창 소스를 알아보자

 

html 부분

<div class="alert">
  <span class="closebtn">&times;</span>  
  <strong>Danger!</strong> Indicates a dangerous or potentially negative action.
</div>

<div class="alert success">
  <span class="closebtn">&times;</span>  
  <strong>Success!</strong> Indicates a successful or positive action.
</div>

<div class="alert info">
  <span class="closebtn">&times;</span>  
  <strong>Info!</strong> Indicates a neutral informative change or action.
</div>

<div class="alert warning">
  <span class="closebtn">&times;</span>  
  <strong>Warning!</strong> Indicates a warning that might need attention.
</div>

 

CSS 분분

.alert {
  padding: 20px;
  background-color: #f44336;
  color: #ffffff;
  margin-bottom: 15px;
}

.alert.success {background-color: #04AA6D;}
.alert.info {background-color: #2196F3;}
.alert.warning {background-color: #ff9800;}

.closebtn {
  margin-left: 15px;
  color: white;
  font-weight: bold;
  float: right;
  font-size: 22px;
  line-height: 20px;
  cursor: pointer;
  transition: 0.3s;
}

.closebtn:hover {
  color: #000000;
}

 

Jquery

$(".closebtn").on("click", function() {
	$(this).parent().css("display","none");	
});

 

 

 

Result(결과)

 

 

 

 

 

반응형

'프로그램' 카테고리의 다른 글

jQuery parents() Method  (0) 2022.01.12
jQuery hover() Method  (0) 2022.01.08
jQuery siblings() Method  (0) 2021.12.31
jQuery parent() Method  (0) 2021.12.31
jQuery find() Method  (0) 2021.12.31

댓글