디자인

웹디자인 사진까지 넣고 그 위에 버튼넣기

바다를바라보다 2020. 11. 30. 22:33

CLASS는 여러 곳에 가능하지만 ID는 한 개만 가능하다

즉, 스타일 CSS에 스타일을 넣어서 효과를 줘야하는데 이를 한눈에 보기쉽게

정리하기 위해선 CLASS를 정해줘서 정리하기도 편하고 각각의 다른효과를 줄 수 있다

 

CSS해부하기

코딩

 

overflow hidden은 마스크와 같은 효과

img/sample-3.jpg는 브라켓으로 끌어온 파일의 경로를 적어주면 사진을 넣을 수가 있다

 

.container{
    text-align: center;
    margin-top: 200px;
    
}

.card-box{
    display: inline-block; 한 줄로 정렬하기
    margin: 10px; 여백
    width: 100%;
    max-width: 280px;
    position : relative;
    border-radius: 16px; 
    overflow: hidden; 마스크 역할?
    width: 280px; 
    height: 360px;
    overflow: hidden;
    box-shadow: 0 20px 35px rgba(0,0,0,26); 박스 그림자
    transition: 0.5s
}
.card-box:hover{  박스 그림자 마우스 댈 시
    transform: scale(0.95);
}
.img-gradient{        
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,1)); 
    z-index: 1; 맨앞으로 보내기?
}
.text-wrap{
    position: absolute;
    bottom: 0;
    padding: 24px; 
    z-index: 2;
    text-align: left;
}
.text-wrap h1{
    color: #fff;
    font-size: 24px;
    margin-bottom: 8px;
    font-weight: bold;
    line-height: 1.5;
    margin: 0;
}
.text-wrap p{
    color: #fff;
    font-size: 18px
        
}
.play-btn{
    width: 60px;
    height: 60px;
    position: absolute;
    right: 24px;
    top: 24px;
    background: #004fff url(../img/icon-play png)
    no-repeat center;
    background-size: 24px;
    border-radius: 50%; 박스 모서리 둥글기
    z-index: 2;
    
    
}

'디자인' 카테고리의 다른 글

웹 사이트 css 포지션 이해하기  (0) 2020.12.03
CSS란 무엇일까?  (0) 2020.12.01
웹 언어 HTML, CSS,java script 배워보자  (0) 2020.11.29
홈페이지 만드는 방법  (0) 2020.11.26
다시 차근차근 웹디 공부  (0) 2020.11.25