1. 완성화면 바로가기

완성화면

소스코드

2. 제작 순서

순서 1. CSS 리셋

/* CSS 스타일 리셋 */
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	font: inherit;
	vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
	display: block;
}
body {
	line-height: 1;
}
ol, ul {
	list-style: none;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}

순서 2. html 페이지 너비에 따라 페이지 안쪽의 콘텐츠 영역의 너비가 조절.

html {
    box-sizing: border-box;
}

순서 3. 자식 요소(.panel)을 가운데로 정렬하기 위해, 부모 요소(body)를 flex-box로 지정하고 콘텐츠 가운데 정렬.

body {
    background-color: #60a9ff;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 400vh;
}

순서 4. 자식 요소들을 가운데로 정렬하기 위해, 부모 요소(.panel)을 flex-box로 지정. 모바일 디바이스의 화면을 기준으로 flex-driection의 주축을 세로방향으로 정하고, 전체 화면의 90%만 차지하게 하고 .panel의 크기는 최대 960px 까지 지정.

.panel {
    background-color: white;
    border-radius: 10px;
    /* padding 세로 | 가로 */
    padding: 15px 25px;
    width: 90%;
    /* 화면 최대 크기(960px) 지정 */
    max-width: 960px;

    display: flex;
    flex-direction: column;
    text-align: center;
}

순서 5.

.pricing-plan {
    border-bottom: 1px solid #e1f1ff;
}

.pricing-plan:last-child {
    border-bottom: none;
}

순서 6.

.pricing-img {
    margin-bottom: 25px;
    width: 100%;
    /* 부모요소(.panel)의 화면최대크기(960px)를 자식요소(.pricing-img)가 그대로 상속 */
    max-width: 100%;
    min-width: 200px;
    
    /* 이미지 바로 위(10px)에 선 긋기 */
    padding-top: 10px;
    border-top: 1px solid #e1f1ff;
}

순서 7. html 앵커 요소에 button 스타일 부여.

/* button 스타일 시트 대표 예제로 참고 */
.pricing-button {
    border: 1px solid #9dd1ff;
    border-radius: 10px;
    color: #348efe;
    display: inline-block;
    padding: 15px 35px;
    margin: 25px 0;
    transition: background-color 0.2s ease-in-out;

    /* 텍스트의 밑줄 없애기 */
    text-decoration: none;
}

.pricing-button:hover {
    background-color: #a9d1ff;
}

순서 8. html 앵커 요소에 button 스타일 부여.

/* 화면이 900이상 커지는 경우 */
@media (min-width: 900px) {
    .panel {
        flex-direction: row;
    }

    .pricing-plan {
        border-bottom: none;
        border-right: 1px solid #e1f1ff;
        padding: 25px 50px;
    }

    .pricing-img {
        width: 200px;
    }

    body {
        height: 100vh;
    }
}

댓글남기기