<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Responsive Navigation Bar</title>

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.8.2/css/all.min.css">

<link href="https://fonts.googleapis.com/css?family=Titillium+Web&display=swap" rel="stylesheet">

<link rel="stylesheet" href="css/style.css">

</head>

 

<body>

    <nav>

        <input type="checkbox" id="check">

        <label for="check" class="checkBtn"><i class="fas fa-bars"></i></label>

        

        <h1 class="logo">DesignX</h1>

        <ul>

            <li><a href="#">home</a></li>

            <li><a href="#">about</a></li>

            <li><a href="#">services</a></li>

            <li><a href="#">contact</a></li>

            <li><a href="#">feedback</a></li>

        </ul>

    </nav>

</body>

</html>

 

-----------------reset.css

@charset "utf-8";

/*reset.css*/

 

@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400;700&display=swap');

 

*margin:0padding:0box-sizing:border-box; }

body { 

    font-family'Titillium Web'sans-serif;            font-size:15pxcolor:#333

    backgroundurl(../imgs/bg.jpgno-repeat center;

    background-attachmentfixed;

    background-sizecover;

}

h1h2h3h4h5h6 { font-family'Merriweather'serif; }

ul li { list-style:nonefloat:left; }

a { display:blocktext-decoration:none; }

img { width:100%; }

.clear { clear:both; }

 

--------------------style.css

 

@charset "utf-8";

 

@import url('reset.css');

 

/*모든 디바이스에 적용할 스타일 시트*/

nav { height80pxpadding:0 50pxbackground:#263;}

nav .logo { 

    displayinline-block

    font-size34pxcolor#fffline-height80px;

}

nav ul { floatrightmargin-top25px;}

nav ul li a { 

    padding:5px 20px;

    color#ffftext-transformuppercaseborder-radius:5px;

    transitionbackground 0.4s ease-in;

}

nav ul li a:hover { background:#797border-radius:5px;}

 

.checkBtn {

    display:nonefloat:right

    font-size:32pxcolor:#fffline-height:80px

    cursorpointer;

}

#check {displaynone;}

 

@media screen and (max-width:1920px) { /*desktop*/

    nav .logo {font-size30px;}

}

@media screen and (max-width:800px) { /*mobile*/

    .checkBtn { display:block; }

    nav ul { 

        position:fixedleft-100%top:55px;

        width100%height100vh;

        text-aligncenter;

        background:rgba(0,0,0,0.7);

        transitionall 0.4s ease-in;

    }

    nav ul li { floatnonepadding35px 0; }

    nav ul li:first-child {margin-top45px;}

    nav ul li a { font-size20px; }

    a:hover { color:#053background:none; }

 

    #check:checked ~ ul { left:0; }

}

 

 

-----------------------html

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=device-width, initial-scale=1">

<title></title>

<link rel="stylesheet" href="css/mediaSpace.css">

</head>

<body>

    <header>

        <h1>logo</h1>

        <nav>

            <ul>

                <li><a href="#">menu1</a></li>

                <li><a href="#">menu2</a></li>

                <li><a href="#">menu3</a></li>

                <li><a href="#">menu4</a></li>

            </ul>

        </nav>

    </header>

</body>

</html>

 

--------mediaSpace.css

 

@charset "utf-8";

 

@import url(reset.css);

 

header { height:60px;  background:#028; }

header h1a { color:#f4f4f4 }

header h1 { float:leftline-height:60px; }

header nav { float:right; }

header a { text-transform:uppercase; }

header a:hover { color:#06fbackground:#fc0border-radius5px; }

 

/*Laptop(1440px), Notebook(1920px), Desktop(FHD:1920px, 4K:2084px, 8K:4096px)*/

@media screen and (min-width:1400px) {

    header { padding:0 50px; }

    header nav { margin-top:15px; }

    header a { padding:5px 25px; }

}

 

/*iPad Pro(1024px), HD(1024px), Desktop(1280px), Notebook(1366px)*/

@media screen and (min-width:1000px) and (max-width:1399px) {

    header { padding:0 30px; }

    header nav { margin-top:15px; }

    header a { padding:5px 25px; }

}

 

/*iPad(768px)*/

@media screen and (min-width:760px) and (max-width:999px) {

    header { padding:0 20pxbackground:#36f; }

    header h1 { line-height:60px; }

    header nav { margin-top:15px; }

    header a { padding:5px 25px;  }

}

 

@media screen and (min-width:570px) and (max-width:759px) {

    header { padding:0 20pxbackground:#36f; }

    header h1 { line-height:60px; }

    header nav { margin-top:15px; }

    header a { padding:5px 25px; }

}

 

/*SmartPhone*/

@media screen and (max-width:569px) {

    header { height:100vh

        background:url(../imgs/bg.jpgno-repeat center;

        background-attachmentfixed;

        background-sizecover; }

    header h1 { 

        position:absoluteleft:50%top:100px;

        font-size54pxcolor:rgba(255,255,255,0.7);

        transform:translateX(-50%); z-index9

    }

    header nav { 

        position:absoluteleft:0top:0width:100%height:100%background:rgba(0,0,0,0.6);

    }

    header ul {width250pxmargin:250px auto 0;}

    header a { 

        width:250pxmargin:15px 0padding:10px 0pxtext-align:centerbackground:rgba(0,0,0,0.3); border-radius5px

    }

}

 

'Coding' 카테고리의 다른 글

CSS 선수학습(12)  (0) 2021.07.27
CSS 선수학습(11)  (0) 2021.07.26
CSS 선수학습(10)  (0) 2021.07.21
CSS 선수학습(9)  (0) 2021.07.21
CSS 복습/실습  (0) 2021.07.20

<!--

※ 반응형 웹 디자인

1.메타 코드 작성

<meta name="viewport" content="sidth=device-width, initial-scale=1">

2.미디어 쿼리(Media Query) 적용: 디바이스의 스크린 크기에 따라 다른 스타일 시트를 적용하는 것.

    2-1. 미디어 쿼리 적용방법

        a. <link> 로 적용

        <link rel="stylesheet" href="./css/fhd-1400.css" media="screen and (min-width:1400px) and (max-width:1920px)">

        <link rel="stylesheet" href="./css/hd-1000.css" media="screen and (min-width:1000px) and (max-width:1399px)">

        <link rel="stylesheet" href="./css/tb-768.css" media="screen and (min-width:760px) and (max-width:999px)">

        <link rel="stylesheet" href="./css/sm.css" media="screen and (max-width:759px)">

 

        b. @media 로 적용

        @media screen and (min-width:1400px) { }

        @media screen and (min-width:1000px) and (max-width:1399px) { }

        @media screen and (min-width:760px) and (max-width:999px) { }

        @media screen and (max-width:759px) { }

 

        ★ <link>보단 @media 를 주로 사용한다.

 

    2-2. 반응형 이미지

        이미지를 선택자로 선택한 후 width를 100%로 지정한다.  

 

    2-3. 부트스트랩(Bootstrap5)의 미디어 쿼리 중단점

        a.576px 미만(xs)

        b.576px 이상(sm)

        c.768px 이상(md)

        d.992px 이상(lg)

        e.1200px 이상(xl)

        f.1400px 이상(xxl)

-->

<!DOCTYPE html>

<html>

<head>

<meta name="viewport" content="sidth=device-width, initial-scale=1">

<meta charset="utf-8">

<title></title>

<link rel="stylesheet" href="./css/media.css">

</head>

 

<body>

    <h2>media query</h2>

    <div></div>

</body>

</html>

 

----------------media.css

@charset "utf-8";

/*media.css*/

 

@import url("reset.css");

 

h2 { padding-top:100pxfont-size:42pxcolor:#06ftext-align:centertext-transform:uppercase; }

div { width:95%height:500pxmargin:100px autobackground:#fc0; }

 

@media screen and (max-width:576px) { 

    body { background:#000; }

    h2 { font-size32pxcolor:#fff; }

    div { width:100%; }

}

/**/

 

@media screen and (min-width:576px) { 

    body { background:#a50; }

    h2 { font-size32pxcolor:#fff; }

    div { width:100%; }

}

/**/

 

@media screen and (min-width:768px) { 

    body{background:#999;}

}

/*tb:768px*/

 

@media screen and (min-width:1000px) { 

    body { background:#0a8; }

    h2 { color:#fff; }

    div { width:950px; }

}

/*hd:1024px*/

 

@media screen and (min-width:1400px) { 

    body { background:#06f; }

    h2 { color:#fff; }

    div { width:1350px; }

}

/*fhd:1920px*/

 

----------------reset.css

 

@charset "utf-8";

/*reset.css*/

 

@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;700&display=swap');

@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@300;400;700&display=swap');

 

*margin:0padding:0box-sizing:border-box; }

body { font-family'Noto Sans KR'sans-seriffont-size:15pxcolor:#333background:#fff;}

h1h2h3h4h5h6 { font-family'Merriweather'serif; }

ul li { list-style:nonefloat:left; }

a { display:blocktext-decoration:none; }

img { width:100%; }

.clear { clear:both; }

 

 

-----------------------

 

<!DOCTYPE html>

<html>

<head>

<meta name="viewport" content="sidth=device-width, initial-scale=1">

<meta charset="utf-8">

<title></title>

<link rel="stylesheet" href="./css/header.css">

</head>

 

<body>

    <header>

        <div class="btn"></div>

        <h1>logo</h1>

 

        <nav>

            <ul>

                <li><a href="#">menu01</a></li>

                <li><a href="#">menu02</a></li>

                <li><a href="#">menu03</a></li>

                <li><a href="#">menu04</a></li>

            </ul>

        </nav>

    </header>

</body>

</html>

 

-----------------header.css

 

@charset "utf-8";

/*media.css*/

 

@import url("reset.css");

 

header {

    height70pxpadding0 50px;

    background#000;

}

h1 { position:absolutetop:15pxfont-size28pxcolor#ffftext-transformuppercase;}

a { padding0 20pxcolor#fff; }

a:hover { color#fc0; }

.btn { floatleftwidth40pxheight40pxmargin:15pxbackground#fffborder-radius5px; }

 

@media screen and (max-width:576px) { 

    header {displayblockpadding0; }

    h1 { left50%transformtranslateX(-50%); }

    nav {displaynone;}

}

/*sm:375px*/

 

@media screen and (min-width:576px) { 

    header {

        displayblock;

        padding0background#550;

    }

    h1 { left50%transformtranslateX(-50%); }

    nav {displaynone;}

}

/**/

 

@media screen and (min-width:768px) { 

    header

        background#086;}

    h1{left:80px;}

    a {padding0 15px;}

    nav {displayblockfloat:rightmargin-top25pxmargin-right50px;}

    .btn {displaynone;}

}

/*tb:768px*/

 

@media screen and (min-width:1000px) { 

    headerbackground#049;}

    a {padding0 30px;}

}

/*hd:1024px*/

 

@media screen and (min-width:1400px) { 

    header { background:#006;}

}

/*fhd:1920px*/

'Coding' 카테고리의 다른 글

CSS 선수학습(13)  (0) 2021.07.27
CSS 선수학습(11)  (0) 2021.07.26
CSS 선수학습(10)  (0) 2021.07.21
CSS 선수학습(9)  (0) 2021.07.21
CSS 복습/실습  (0) 2021.07.20

<!--

트랜지션과 애니메이션 다른점

트랜지션은 시작점과 끝점만 존재한다.

하지만 애니메이션은 시작점과 중간점, 끝점이 존재한다.

 

1.애니메이션 등록

    @keyframe 애니메이션명 {

        0% {스타일시트 적용}

        50% {스타일시트 적용}

        100% {스타일시트 적용}

    }

2.애니메이션 적용

    선택자 {animation:애니메이션명 진행시간 가속도 지연시간 반복횟수 방향지정;}

    반복횟수:infinite(무한반복), 숫자(반복횟수를 숫자로 지정)

    방향지정:normal(좌>우), alternate(좌>우>좌)

 

-->

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title></title>

<style>

    *{margin:0padding:0box-sizing:border-box;}

    divwidth250pxheight250pxbackground#000;

        animation:ani 3s ease-in-out infinite alternate;

    }

    @keyframes ani

        0% {transform:translate(0,0rotate(0deg);}

        50% {

            transform:translate(200px,0rotate(90deg);

            border-radius:50%;

        }

        100% { transform:translate(600px0rotate(360deg);}

    }

</style>

</head>

<body>

    <div></div>

</body>

</html>

 

---------------------------

 

 

<!--

※ 스타일시트 속성

1.박스 속성

display 속성: 박스의 유형(none:박스제거, block, inline-block, inline, flex)을 변경하는 속성

width 속성: 박스의 너비값 지정(데스크탑:px, 모바일:% / 부모요소:px, 자식요소:%)

height 속성: 박스의 높이값 지정(풀스크린:vh/ px)

margin 속성: 박스 외부 여백 지정(박스를 움직여서 배치)

padding 속성: 박스 내부 여백 지정(웹 콘텐츠를 수직중앙정렬, 박스 크기 확장)

border 속성: 박스 테두리 지정 

border-radius : 박스의 형태를 변경 (모서리를 둥글게 처리)

box-sizing 속성: 박스의 너비와 높이에 padding과 border의 포함여부를 지정

box-shadow 속성: 박스의 그림자 지정 (0 0 0 20px rgba(0,0,0,0.3))

 

justify-content 속성: 아이템의 수평정렬(space-between)

align-items 속성: 아이템의 수직 정렬(center)

 

2.위치 속성

position 속성: 박스의 배치를 좌표값으로 지정(relative: 좌표의 기준점을 변경, absolute: 박스를 절대좌표로 위치/박스를 겹침, fixed:박스를 고정)

left 속성

right 속성

top 속성

bottom 속성

 

3.글자 속성

font-family 속성

font-size 속성

color 속성

font-weight 속성

font-style 속성

text-align 속성

line-height 속성

text-decoration 속성

text-transform 속성

text-shadow 속성

letter-spacing 속성

word-spacing 속성

 

4.배경 속성

background 속성(배경색상 배경이미지 반복여부 위치)

background-attachment  속성: fixed(고정)

background-size 속성: cover(박스의 크기에 맞춘다)

-->

 

 

-----

 

 

<!--

디바이스(단말기)의 크기에 따라 최적화된 화면을 제공한다.

모바일 단말기의 웹부라우저 해상도(385px, 420px, 768px, 1024px)에 맞춰라.

-->

 

<!DOCTYPE html>

<html lang="ko">

<head>

<meta charset="utf-8">

<meta name="viewport" content="width=divice-width, initial-scale=1">

<title>애니메이션실습문제</title>

<style>

*{margin0padding0box-sizingborder-box;}

header {

    displayflex;

    justify-contentspace-between;

    align-itemscenter;

    height70pxpadding0 50pxbackground#000;

}

h1 acolor:#ffftext-decorationnone; }

h1 a:hover{

    animation:ani 1s infinite;

    cursorpointer;

}

@keyframes ani {

    0% {colorred;}

    25% {colorpurple;}

    50% {colorblue;}

    75% {colorgreen;}

    100% {colorbrown;}

}

 

ul { list-stylenone;

    displayflex;

}

ul li a {

    display:blockheight40pxmargin:0 10pxpadding8px 30px

    text-decorationnone

    border1px solid transparent;

    color#fff;

    transitionlinear 0.15s; }

 

li a:hover{

    border1px solid #fff;

    border-radius25px;

    backgroundlinear-gradient(to bottomrgb(2012312550%rgb(7816021450%rgb(8410421951%rgb(136183255100%);

    color#000;

    text-shadow0 1px 1px #fff;; 

}

 

</style>

 

</head>

 

<body>

 

    <header>

        <h1><a href="#">회사로고</a></h1>

        <nav>

                <ul>

                <li><a href="#">메뉴1</a></li>

                <li><a href="#">메뉴2</a></li>

                <li><a href="#">메뉴3</a></li>

                <li><a href="#">메뉴4</a></li>

            </ul>

        </nav>

    </header>

</body>

</html>

 

'Coding' 카테고리의 다른 글

CSS 선수학습(13)  (0) 2021.07.27
CSS 선수학습(12)  (0) 2021.07.27
CSS 선수학습(10)  (0) 2021.07.21
CSS 선수학습(9)  (0) 2021.07.21
CSS 복습/실습  (0) 2021.07.20

<!--

트랜지션(전환)은 사용자의 이벤트(클릭, 더블클릭, 드래그, 스크롤 등)가 없는 처음(시작)상태와 사용자의 이벤트가 있는 나중(끝)상태 사이의 모습을 자동으로 생성해준다.

 

transition-property: 트랜지션을 적용할 속성을 지정(all, width, height 등)

transition-duration: 진행 시간(ex> 0.4s)

transition-timing-function: 움직이는 시작과 끝의 속도를 지정(가속도)

transition-delay: 대기 시간

 

transition:property duration timing-function delay;

-->

<!DOCTYPE html>

<html lang="ko">

<head>

<meta charset="utf-8">

<title>Transition</title>

<style>

    /*박스의 처음 상태*/

    div { width:300pxheight:100pxmargin:10pxbackground:#fc0; }

    .box1 { transition:width 0.4s ease-in;}

    .box2 { transition:width 0.4s ease-in 0.8s;}

    .box3 { transition:height 0.4s ease-in;}

    /*박스의 나중 상태*/

    .box1:hover { width:1000px;}

    .box2:hover { width:500px;}

    .box3:hover { height:500px;}

 

    h2margin-top:100pxtext-transform:uppercasetext-align:center;}

    .demo { 

        positionrelative

        width700pxheight500pxmargin:30px auto

        background#e8e8e8 ;border-right5px solid #900;

    }

    .demo div {

        positionabsoluteleft0width70pxheight70px

        text-aligncenterline-height70px;

        border5px solid #00cborder-radius:50%;

    }

    .linear { top:0transition:all 2s linear;}

    .ease { top:100pxtransition:all 2s ease 0.5s;}

    .ease-in { top200pxtransition:all 2s ease-in 1s;}

    .ease-out { top300pxtransition:all 2s ease-out 1.5s;}

    .ease-in-out { top400pxtransition:all 2s ease-in-out 2s;}

 

    .demo:hover div { left:625pxtransform:rotate(1080deg);}

 

</style>

</head>

 

<body>

    <div class="box1"></div>

    <div class="box2"></div>

    <div class="box3"></div>

 

    <h2>transition-timing-function</h2>

    <div class="demo">

        <div class="linear">linear</div>

        <div class="ease">ease</div>

        <div class="ease-in">easein</div>

        <div class="ease-out">easeout</div>

        <div class="ease-in-out">easeinout</div>

    </div>

</body>

</html>

 

----------------------------

 

<!--

트랜스폼 2D 함수: translate( ), translateX( ), translateY( ), rotate( ), skew( ), scale( )

-->

<!DOCTYPE html>

<html lang="ko">

<head>

<meta charset="utf-8">

<title>2D Transform</title>

<style>

    *{margin:0padding:0box-sizingborder-box;}

    .container { 

        positionrelative;

        width1000pxheight:1000pxmargin:0 auto;background:#f4f4f4

    }

    .container div {

        positionabsolute;

        width:200pxheight:200pxmargin:50px 0;

        font-size:32pxcolor:#ffftext-align:centerline-height:200px;

        background:#06f;

        transition:all 0.4s ease-in;

    }

    .container:hover div:nth-child(1) { transform:translateX(800px);}

    .container:hover div:nth-child(3) { transform:translateY(800px);}

    .container:hover div:nth-child(2) { transform:translate(800px800px);}

 

    .demo { 

        positionrelative;

        width1000pxheight:1000pxmargin:50px auto;background:#f4f4f4

    }

    .demo div {

        positionabsolute;

        width:200pxheight:200pxmargin:50px 0;

        font-size:32pxcolor:#ffftext-align:centerline-height:200px;

        background:#fc0;

        transition:all 0.4s ease-in;

    }

    .demo div:nth-child(1) { top0; }

    .demo div:nth-child(2) { top250px; }

    .demo div:nth-child(3) { top500px; }

 

    .demo:hover div:nth-child(1) { background:#06ftransform:translate(500px300pxscale(2.5rotate(1080degskew(45deg0);}

    .demo:hover div:nth-child(2) { transform:rotate(720deg);}

    .demo:hover div:nth-child(3) { transform:skew(0-30deg);}

 

    button { 

        width120pxheight40px

        font-size18pxtext-aligncenterline-height40px;

        background#888border-radius20pxbordernone;

        }

    .box { width300pxheight300pxbackground#030transition:all 0.4s ease-in;}

    .active { transform:scale(2rotate(40degtranslate(200px100px); }

 

</style>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

<script>

    $(document).ready(function(e) {

        $('button').click(function( ) {

            $('.box').addClass('active'); //클래스명을 추가하는 메서드

         });

        $('button').mouseover(function( ) {

            $('.box').removeClass('active'); //클래스명을 삭제하는 메서드

         });

    });

//

혹은

    $(document).ready(function(e) {

        $('button').click(function( ) {

            $('.box').toggleClass('active'); //클래스명 추가와 제거를 반복하는 메서드

         });

    });

//

</script>

</head>

 

<body>

    <button>버튼</button>

    <div class="box"></div>

 

    <div class="container">

        <div>translateX( )</div>

        <div>translate( )</div>

        <div>translateY( )</div>

    </div>

 

    <div class="demo">

        <div>scale( )</div>

        <div>rotate( )</div>

        <div>skew( )</div>

    </div>

 

    </body>

</html>

 

-------------------------------

<!--

트랜스폼 3D 함수: translate3d(x,y,z), translateZ(z), rotate3d(x, y, z, deg) 

 

perspective() : 원근감을 지정(:부모요소에 작성하면 자식요소에 적용, 손자 요소에는 적용 안 됨. > 자식요소에 transform-style:preserve-3d 를 작성하면 손자 요소에도 적용된다.)

-->

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title>3D transform</title>

<style>

    * {margin:0padding:0;}

    .clear { clear:both; }

 

    ul {width:1000pxmargin:50px autoperspective:700px;} 

    ul li { 

        list-style:nonefloat:left;

        width:280pxheight:280pxmargin:20px;

        font-size:24pxcolor:#ffftext-align:centerline-height:300px;

        background:#36fopacity:0.4;/*60% 투명*/

        border:5px solid #a6f;

        transition:all 0.4s ease-in;

    }

        ul li:nth-child(1):hover {transformrotate3d(1,0,0,-360deg);}

        ul li:nth-child(2):hover {transformrotate3d(0,1,0,-360degscale(2);}

        ul li:nth-child(3):hover {transformtranslateZ(-500px);}

</style>

 

</head>

 

<body>

    <ul>

        <li>rotate3d(x)</li>

        <li>rotate3d(y)</li>

        <li>rotate3d(z)</li>

    </ul>

    <div class="clear"></div>

</body>

</html>

'Coding' 카테고리의 다른 글

CSS 선수학습(12)  (0) 2021.07.27
CSS 선수학습(11)  (0) 2021.07.26
CSS 선수학습(9)  (0) 2021.07.21
CSS 복습/실습  (0) 2021.07.20
CSS 선수학습(8)  (0) 2021.07.19

<!--

    ※ FlexBox

    1. 부모 요소인 container와 자식 요소인 items가 반드시 필요하다. 

        <div class="container">

            <div class="item"></div>

            <div class="item"></div>

            <div class="item"></div>

        </div>

    2. 부모 요소인 container에 사용하는 스타일 속성

        - display:flex; 플렉스 박스임을 지정

            > 아이템 박스들이 좌에서 우로 배치된다.

        - justify-content:space-between; 아이템의 수평 정렬을 지정

            > flex-start: 왼쪽 정렬

            > flex-end: 오른쪽 정렬

            > center: 중앙 정렬

            > space-between: 양끝 정렬

            > space-around: 양끝 정렬(좌우에 여백 생성)

            > space-evenly: 양끝 정렬(아이템 주변에 균등한 여백을 생성)

        - align-items:center; 아이템의 수직 정렬

        - flex-direction:column; 아이템을 줄바꿈 한다.

    3. 자식 요소인 item에 사용하는 스타일 속성

        -order:숫자; 숫자가 양수이면 오른쪽으로 배치, 음수이면 왼쪽으로 배치됨.

--> 

 

<!DOCTYPE html>

<html lang="ko">

<head>

<meta charset="utf-8">

<title>플렉스 좌우배열</title>

<style>

    * { margin:0padding:0box-sizing:border-box; }

    .box {

        width1100pxmargin30px autopadding:20px;

        box-shadow0 0 25px #666 ;

    }

    .container {

        displayflex;

        justify-contentspace-around;

        align-itemscenter;

        padding10px 0;

        border-bottom1px solid #999;

    }

    .container img {width20%;}

    .container p {width75%;}

    p.second { order:-1;}

    .bn { bordernone;}

    

</style>

</head>

 

<body>

    <div class="box">

        <div class="container">

            <img src="./imgs/photo1.jpg" alt="삽화">

            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nisl tincidunt eget nullam non. Quis hendrerit dolor magna eget est lorem ipsum dolor sit. Volutpat odio facilisis mauris sit amet massa. Commodo odio aenean sed adipiscing diam donec adipiscing tristique.  </p>

        </div>

        <div class="container">

            <img src="./imgs/photo1.jpg" alt="삽화">

            <p class="second">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nisl tincidunt eget nullam non. Quis hendrerit dolor magna eget est lorem ipsum dolor sit. Volutpat odio facilisis mauris sit amet massa. Commodo odio aenean sed adipiscing diam donec adipiscing tristique.   </p>

        </div>

        <div class="container">

            <img src="./imgs/photo1.jpg" alt="삽화">

            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nisl tincidunt eget nullam non. Quis hendrerit dolor magna eget est lorem ipsum dolor sit. Volutpat odio facilisis mauris sit amet massa. Commodo odio aenean sed adipiscing diam donec adipiscing tristique.   </p>

        </div>

        <div class="container">

            <img src="./imgs/photo1.jpg" alt="삽화">

            <p class="second">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nisl tincidunt eget nullam non. Quis hendrerit dolor magna eget est lorem ipsum dolor sit. Volutpat odio facilisis mauris sit amet massa. Commodo odio aenean sed adipiscing diam donec adipiscing tristique.   </p>

        </div>

        <div class="container bn">

            <img src="./imgs/photo1.jpg" alt="삽화">

            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nisl tincidunt eget nullam non. Quis hendrerit dolor magna eget est lorem ipsum dolor sit. Volutpat odio facilisis mauris sit amet massa. Commodo odio aenean sed adipiscing diam donec adipiscing tristique.  </p>

        </div>

    </div>

</body>

</html>

 

 

--------------실습문제 선생님풀이

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>실습문제</title>

<style>

    * { margin:0padding:0box-sizing:border-box; }

    .clear { clear:both; }

    

    

    header {

        display:flex;

        justify-content:space-between;

        align-items:center;

        height:70pxpadding:0 50pxbackground:#06f;       

    }

    h1 { color:#fff; }

    ul li { float:leftlist-style:none; }

    ul li a {

        padding:5px 30px;

        color:#ffftext-decoration:nonetext-transform:uppercase;

    }

    ul li a:hover { color:#36fbackground:#fc0border-radius:5px; }

    

    

    section { width:1300pxmargin:0 auto; }

    article {

        float:leftwidth:80%padding:30px;

        border-right:1px solid #666;

    }   

    article figure { float:rightwidth:50%padding:20px 50px; }

    article figure img {

        width:100%border:3px solid #fff;

        box-shadow:0 0 10px #666;

    }

    article figure figcaption { padding-top:15pxtext-align:center; }

    article p { padding-top:20px; }

    aside { float:rightwidth:20%padding:30px; }

    aside ul { margin-top:30px; }

    aside ul li a { display:blockmargin:5px 0color:#333; }

    

    

    footer {

        height:200px;

        border-top:1px solid #666;

    }

</style>

</head>

 

<body>

    <header>

        <h1>회사이름</h1>

        <nav>

            <ul>

                <li><a href="#">menu1</a></li>

                <li><a href="#">menu2</a></li>

                <li><a href="#">menu3</a></li>

                <li><a href="#">menu4</a></li>

            </ul>

        </nav>

    </header>

    

    <section>

        <article>

            <h3>제목</h3>

            <figure>

                <img src="./imgs/ipad.jpg" alt="art">

                <figcaption>할리 데이비슨</figcaption>

            </figure>

            <p>

                정당은 법률이 정하는 바에 의하여 국가의 보호를 받으며, 국가는 법률이 정하는 바에 의하여 정당운영에 필요한 자금을 보조할 수 있다. 국회는 상호원조 또는 안전보장에 관한 조약, 중요한 국제조직에 관한 조약, 우호통상항해조약, 주권의 제약에 관한 조약, 강화조약, 국가나 국민에게 중대한 재정적 부담을 지우는 조약 또는 입법사항에 관한 조약의 체결·비준에 대한 동의권을 가진다.

 

국회는 국민의 보통·평등·직접·비밀선거에 의하여 선출된 국회의원으로 구성한다. 근로조건의 기준은 인간의 존엄성을 보장하도록 법률로 정한다. 모든 국민은 거주·이전의 자유를 가진다.

            </p>

            <p>

                정당은 법률이 정하는 바에 의하여 국가의 보호를 받으며, 국가는 법률이 정하는 바에 의하여 정당운영에 필요한 자금을 보조할 수 있다. 국회는 상호원조 또는 안전보장에 관한 조약, 중요한 국제조직에 관한 조약, 우호통상항해조약, 주권의 제약에 관한 조약, 강화조약, 국가나 국민에게 중대한 재정적 부담을 지우는 조약 또는 입법사항에 관한 조약의 체결·비준에 대한 동의권을 가진다.

 

국회는 국민의 보통·평등·직접·비밀선거에 의하여 선출된 국회의원으로 구성한다. 근로조건의 기준은 인간의 존엄성을 보장하도록 법률로 정한다. 모든 국민은 거주·이전의 자유를 가진다.

            </p>

            <p>

                정당은 법률이 정하는 바에 의하여 국가의 보호를 받으며, 국가는 법률이 정하는 바에 의하여 정당운영에 필요한 자금을 보조할 수 있다. 국회는 상호원조 또는 안전보장에 관한 조약, 중요한 국제조직에 관한 조약, 우호통상항해조약, 주권의 제약에 관한 조약, 강화조약, 국가나 국민에게 중대한 재정적 부담을 지우는 조약 또는 입법사항에 관한 조약의 체결·비준에 대한 동의권을 가진다.

 

국회는 국민의 보통·평등·직접·비밀선거에 의하여 선출된 국회의원으로 구성한다. 근로조건의 기준은 인간의 존엄성을 보장하도록 법률로 정한다. 모든 국민은 거주·이전의 자유를 가진다.

            </p>            

        </article>

        <aside>

            <h4>사이드바 제목</h4>

            <ul>

                <li><a href="#">사이드 메뉴1</a></li>

                <li><a href="#">사이드 메뉴2</a></li>

                <li><a href="#">사이드 메뉴3</a></li>

            </ul>

        </aside>

    </section>

    <div class="clear"></div>

    

    <footer></footer>

</body>

</html>

 

'Coding' 카테고리의 다른 글

CSS 선수학습(11)  (0) 2021.07.26
CSS 선수학습(10)  (0) 2021.07.21
CSS 복습/실습  (0) 2021.07.20
CSS 선수학습(8)  (0) 2021.07.19
CSS 선수학습(7)  (0) 2021.07.16

<!DOCTYPE html>

<html lang="ko">

<head>

<meta charset="utf-8">

<title>실습</title>

<style>

* { margin:0padding:0box-sizing:border-box; }

@import url('https://fonts.googleapis.com/css2?family=Nanum+Myeongjo:wght@400;700&display=swap');

@import url('https://fonts.googleapis.com/css2?family=Nanum+Gothic&display=swap');



.container { positionfixedwidth100%height100vh;

backgroundurl(./imgs/office.jpgno-repeat center;

background-attachmentfixed;

background-sizecover;}

 

section { 

    width60%height90%margin10px autopadding30px;

    backgroundrgba(2552552550.7); border-radius9px;}

 

h2h3 {font-family'Nanum Myeongjo'seriftext-aligncenterpadding15px 0;}

 

h2 { font-size30px;}

h3 { font-size20px;}

 

p {font-family'Nanum Gothic'sans-seriftext-indent30pxline-height25pxpadding10px 0;}

 

blockquote {

    padding:20px 80px;

    font-family'Nanum Myeongjo'serif;

    line-height30px;

}

blockquote:beforeblockquote:after {        

    displayinline-block;

    vertical-alignbottom;

    colorgray;

    height25px;

    line-height50px;

    font-size50px;

}

blockquote:before {

    content'\201C';

    margin-right5px;

}

blockquote:after {

    content'\201D';

}



</style>

</head>

 

<body>

    <div class="container">

        <section>

            <h2>국정의 중요한 사항에 관한 대통령의 자문</h2>

            <h3> 국가안전보장회의는 대통령이 주재한다.</h3>

            <hr color="gray">

            <p>법률은 특별한 규정이 없는 한 공포한 날로부터 20일을 경과함으로써 효력을 발생한다. 모든 국민은 양심의 자유를 가진다. 대통령은 전시·사변 또는 이에 준하는 국가비상사태에 있어서 병력으로써 군사상의 필요에 응하거나 공공의 안녕질서를 유지할 필요가 있을 때에는 법률이 정하는 바에 의하여 계엄을 선포할 수 있다.</p>

            <p>국회의원의 선거구와 비례대표제 기타 선거에 관한 사항은 법률로 정한다. 정당은 법률이 정하는 바에 의하여 국가의 보호를 받으며, 국가는 법률이 정하는 바에 의하여 정당운영에 필요한 자금을 보조할 수 있다. 국토와 자원은 국가의 보호를 받으며, 국가는 그 균형있는 개발과 이용을 위하여 필요한 계획을 수립한다.</p>

 

            <blockquote>국무총리는 대통령을 보좌하며, 행정에 관하여 대통령의 명을 받아 행정각부를 통할한다. 농업생산성의 제고와 농지의 합리적인 이용을 위하거나 불가피한 사정으로 발생하는 농지의 임대차와 위탁경영은 법률이 정하는 바에 의하여 인정된다. 정당의 설립은 자유이며, 복수정당제는 보장된다. 재판의 심리와 판결은 공개한다. </blockquote>

 

            <p>국민의 자유와 권리는 헌법에 열거되지 아니한 이유로 경시되지 아니한다. 국무회의는 대통령·국무총리와 15인 이상 30인 이하의 국무위원으로 구성한다. 국가원로자문회의의 조직·직무범위 기타 필요한 사항은 법률로 정한다. 군인은 현역을 면한 후가 아니면 국무총리로 임명될 수 없다. 대통령으로 선거될 수 있는 자는 국회의원의 피선거권이 있고 선거일 현재 40세에 달하여야 한다. </p>

            <p>제1항의 탄핵소추는 국회재적의원 3분의 1 이상의 발의가 있어야 하며, 그 의결은 국회재적의원 과반수의 찬성이 있어야 한다. 다만, 대통령에 대한 탄핵소추는 국회재적의원 과반수의 발의와 국회재적의원 3분의 2 이상의 찬성이 있어야 한다. 법관은 탄핵 또는 금고 이상의 형의 선고에 의하지 아니하고는 파면되지 아니하며, 징계처분에 의하지 아니하고는 정직·감봉 기타 불리한 처분을 받지 아니한다. </p>

        </section>

    </div>

 

</body>

</html>

 

 

----------

<!DOCTYPE html>

<html lang="ko">

<head>

<meta charset="utf-8">

<title>플렉스박스 실습 이미지모음</title>

<style>

* { margin:0padding:0box-sizing:border-box; }

 

section { 

    displayflex;

    justify-contentspace-between;

    align-itemsflex-start;

    width100%max-width1200pxmargin0 auto;

}

div { width33.33%height280pxmargin5px;}

div img { width100%; }

 

</style>

</head>

 

<body>

    <section>

        <div><img src="./imgs/bg.jpg"></div>

        <div><img src="./imgs/chess.jpg"></div>

        <div><img src="./imgs/office.jpg"></div>

    </section>

 

    <section>

        <div><img src="./imgs/ipad.jpg"></div>

        <div><img src="./imgs/glass.jpg"></div>

        <div><img src="./imgs/photo1.jpg"></div>

    </section>

</body>

</html>

 

------------------------------

<!DOCTYPE html>

<html lang="ko">

<head>

<meta charset="utf-8">

<title>플렉스박스 실습 로그인창</title>

<style>

* { margin:0padding:0box-sizing:border-box; }

 

section { 

    displayflex;

    justify-contentcenter;

    align-itemscenter;

    width100%height100vh;

    background#999;

}

.login { width400pxheight300px

    background:#fff

    border-radius9pxbox-shadow0 0 10px #000

}

 

h3 {width90%margin0 autopadding:40px 0 20px;

    font-size28pxtext-aligncenter;

    border-bottom1px solid #999;

}

ul { width60%margin20px auto;}

ul li {list-style:nonemargin5px 0;}

ul li input {width100%height35pxpadding-left10px;}



</style>

</head>

 

<body>

    <section>

        <div class="login"> 

           <h3>회원 로그인</h3>

           <ul>

               <li><input type="text" name="id" placeholder="아이디" required></li>

               <li><input type="text" name="pwd" placeholder="비밀번호" required></li>

               <li><input type="submit" value="확인"></li>

           </ul>

        </div>

    </section>

 

</body>

</html>

 

---------------

 

<!DOCTYPE html>

<html lang="ko">

<head>

<meta charset="utf-8">

<title>플렉스박스 실습 사이드바</title>

<style>

* { margin:0padding:0box-sizing:border-box; }

aside {

    displayflex;

    flex-directioncolumn;

    justify-contentspace-between;

    align-itemscenter;

    width200pxheight100vhpadding:30px 0

    backgroundcornflowerblue;

}

 

ul {margin-left50px;}

ul li { list-stylenone; }

ul li a { displayblockmargin:10pxpadding:10px 30pxbackground:rgba(255,255,255,0.3); border1px solid #fffborder-radius5pxtext-decorationnonecolor#fff;}

ul li a:hover {color:#333background:rgba(255,255,255,0.8)}

</style>

</head>

 

<body>

    <aside>

        <ul>

            <li><a href="#">사이드1</a></li>

            <li><a href="#">사이드2</a></li>

            <li><a href="#">사이드3</a></li>

        </ul>

        <ul>

            <li><a href="#">하단1</a></li>

            <li><a href="#">하단2</a></li>

        </ul>

    </aside>

 

</body>

</html>

'Coding' 카테고리의 다른 글

CSS 선수학습(10)  (0) 2021.07.21
CSS 선수학습(9)  (0) 2021.07.21
CSS 선수학습(8)  (0) 2021.07.19
CSS 선수학습(7)  (0) 2021.07.16
CSS 선수학습(6)  (0) 2021.07.15

<!--

    1.img 태그를 사용하여 이미지 콘텐츠를 저장 :하이퍼링크가 있다

    2.배경 속성을 사용하여 배경 이미지로 저장 :하이퍼링크가 없다

 

    ※배경 속성

    background: 배경색상 배경이미지반복여부(repeat, repeat-x, repeat-y) 배경위치(left/center/right top/center/bottom);

    background-attachment:fixed; 배경이미지를 고정

    background-size:cover; 배경이미지를 박스크기로 확장

 

    ※벤더 프리픽스 :브랜드 접두사 >크로스 브라우징

    1. 크롬:-webkit-

    2.사파리:-webkit-

    3.파이어 폭스:-moz-

    4.오페라:-o-

    5.인터넷 익스플로러:-ms-

-->

<!DOCTYPE html>

<html lang="ko">

<head>

<meta charset="utf-8">

<title>배경속성</title>

<style>

    * {margin:0padding:0box-sizingborder-box

    @import url('https://fonts.googleapis.com/css2?family=Abril+Fatface&display=swap');

    @import url('https://fonts.googleapis.com/css2?family=Roboto+Condensed:wght@300;400;700&display=swap');

    h1h2h3h4 h5h6 { font-family'Abril Fatface', cursive; }

    body { font-family'Roboto Condensed'sans-serif;font-size:15pxcolor#333background:#a7b1a3 url(./imgs/back-sample1.jpgrepeat-y center; }



    header {width100%height70pxbackgroundwhite;}

    header img { height:40pxmargin:15px 0 0 50px;}



    section { width:1000pxmargin:0 auto; }

    .bn { position:relativewidth100%height200pxbackground#000 url(./imgs/chess.jpgno-repeat left center;}

    .bn h2 { 

        position:absoluteright50pxtop:80px

        font-size:92pxcolor#fff;text-transformcapitalize; }

    .fix { 

        height:300pxmargin:200px 0padding:25px 0

        backgroundurl(./imgs/ipad.jpgno-repeat center

        background-attachmentfixed;

        background-sizecover;

         }

    .fix p {

        width500pxheight250px

        margin:0 auto;

        padding20px;

        color:#fff

        backgroundrgba(0,0,0,0.7);

        }

 

        .gradient {

            width:300pxheight100pxmargin200px auto;

            backgroundlinear-gradient( to leftsalmon 0%skyblue 50%wheat 100%);

            border-radius50px;

        }

        

        .repeat-linear-gradient {

            width300pxheight200pxmargin150px auto;

            backgroundrepeating-linear-gradient(#daff#daff 20px#adff 35px#ddaf 50px);

        }

        .repeat-radial-gradient {

            width600pxheight600pxmargin150px auto;

            text-align:center;

            background:repeating-radial-gradient(#daff#daff 20px#adff 35px#ddaf 50px);

        }

        .repeat-radial-gradient img {margin-top60px;}

 

        .box1 {width200pxheight200pxmargin50px auto;

        backgroundurl(./imgs/office.jpg);background-sizecover;}

 

        .colorzilla {

            width500pxheight150pxmargin300px auto;

            /* Permalink - use to edit and share this gradient: https://colorzilla.com/gradient-editor/#afabe8+0,ffbcbc+31,bcf5ff+68,faffbc+100 */

        backgroundrgb(175,171,232); /* Old browsers */

        background-moz-linear-gradient(-45deg,  rgba(175,171,232,10%rgba(255,188,188,131%rgba(188,245,255,168%rgba(250,255,188,1100%); /* FF3.6-15 */

        background-webkit-linear-gradient(-45deg,  rgba(175,171,232,10%,rgba(255,188,188,131%,rgba(188,245,255,168%,rgba(250,255,188,1100%); /* Chrome10-25,Safari5.1-6 */

        backgroundlinear-gradient(135deg,  rgba(175,171,232,10%,rgba(255,188,188,131%,rgba(188,245,255,168%,rgba(250,255,188,1100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */

        filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#afabe8', endColorstr='#faffbc',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */}

 

</style>

</head>

<body>

    <header>

        <a href="#"><img src="./imgs/delion.png"></a>

    </header>

 

    <section>

        <div class="bn"><h2>chess</h2></div>

        <div class="fix">

            <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Nisl tincidunt eget nullam non. Quis hendrerit dolor magna eget est lorem ipsum dolor sit. Volutpat odio facilisis mauris sit amet massa. Commodo odio aenean sed adipiscing diam donec adipiscing tristique. Mi eget mauris pharetra et. Non tellus orci ac auctor augue. Elit at imperdiet dui accumsan sit. Ornare arcu dui vivamus arcu felis. Egestas integer eget aliquet nibh praesent. In hac habitasse platea dictumst quisque sagittis purus. Pulvinar elementum integer enim neque volutpat ac.

            </p>

        </div>

        <div class="gradient"></div>

        <div class="repeat-linear-gradient"></div>

        <div class="repeat-radial-gradient">

            <img src="./imgs/logo.png">

            <div class="box1"></div>

            <div class="colorzilla"></div>

        </div>

        

    </section>

</body>

</html>

--------------------------------- Parallax Scrolling

<!DOCTYPE html>

<html lang="ko">

<head>

<meta charset="utf-8">

<title></title>

<style>

* { margin:0padding:0box-sizing:border-box; }

body { height15000px; }

 .bg {

     height100vh

     backgroundurl(./imgs/bg.jpgno-repeat center;

     background-sizecover;

 }

 .small-bg {

     positionabsolutetop:50%width100%height200pxmargin-top-100px;

     backgroundurl(./imgs/bg.jpgno-repeat center;

     background-attachmentfixed;

     background-sizecover;

 }

 .bg h2 { positionabsolutetop:80%width100%font-size:95pxcolor:#ffftext-aligncentertext-transformuppercase;}

</style>

</head>

 

<body>

    <div class="bg">

        <div class="small-bg"></div>

        <h2>fox</h2>

    </div>

 

</body>

</html>

'Coding' 카테고리의 다른 글

CSS 선수학습(9)  (0) 2021.07.21
CSS 복습/실습  (0) 2021.07.20
CSS 선수학습(7)  (0) 2021.07.16
CSS 선수학습(6)  (0) 2021.07.15
CSS 선수학습(5)  (0) 2021.07.14

<!--

※글자 속성

font-family : 글꼴을 지정 (운영체제에 설치된 폰트) 

font-size : 폰트의 크기를 지정

color : 폰트의 색상을 지정 (색상코드, rgb(), rgba())

font-weight : 폰트의 두께를 지정 (thin, regular, bold, 지원되는 지정값)

 

text-align : 글자 정렬(left(기본값), center, right)

line-height : 글자 행 간격을 지정

text-transform : 영문자를 대문자, 소문자로 변경 (uppercase, lowercase, captalize)

text-decoration : 글자의 언더바를 제거(none), 밑줄 표시(underline), 윗줄표시(overline)

text-shadow : 글자에 그림자 생성 (값1, 2, 3, 4)

값1-오른쪽 그림자의 거리

값2-아래쪽 그림자의 거리

값3-번짐의 정도

값4-그림자의 색상

 

※ 글꼴 지정 방식: 웹사이트 전체에 적용하는 글꼴(본문 내용)이 있고 제목에 적용하는 글꼴이 있다. 본문 내용은 고딕체(sans-serif)로 사용하고, 제목은 주로 명조체(serif)로 사용한다. 본문 내용에 사용하는 글꼴의 지정은 body요소에 적용하고 제목에 사용하는 글꼴의 지정은 h요소에 적용한다. 

(ex.body { font-family : roboto, sans-serif; }

h1, h2, h3 { font-family: Uchen, serif; } )

지정한 폰트가 없는 유저를 위해 대체 폰트를 여러개 적을 수 있다. 

 

※웹 폰트 

운영체제에 설치된 서체를 적용하는 것이 아니라 웹 서버에 있는 글꼴을 적용.

① @font-face 속성의 사용

    -eot 와 woff 폰트 포맷을 생성한다.

    -@font-face 속성으로 글꼴을 적용.

② 구글 웹 폰트 서비스의 사용

 

※폰트 크기 단위

①고정형: px

②가변형: %, em, rem

-->

<!DOCTYPE html>

<html lang="ko">

<head>

<meta charset="utf-8">

<title>글자속성</title>

<link rel="preconnect" href="https://fonts.googleapis.com">

<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>

<link href="https://fonts.googleapis.com/css2?family=Gugi&display=swap" rel="stylesheet">

<style>

    @font-face {

        font-family: chs; /*글꼴명 지정*/

        src:url(./fonts/ChosunNm.eot);

        src:url(./fonts/ChosunNm.woffformat('woff');

    }

    

    body { font-family'Gugi', cursive; font-size15pxcolor#333;  text-aligncenter;} 

    h1h2h3h4h5h6 { font-family: chs, seriffont-size42pxcolor:#ffftext-aligncentertext-decorationunderlinetext-transformuppercasetext-shadow1px 1px 5px hotpinkletter-spacing-2pxword-spacing5px;}

 

    section h3 {text-indent-3000px;} /*텍스트를 웹 브라우저에 표시하고 싶지 않은 경우에 사용한다*/

 

    section p { width200pxmargin:200px auto

        white-space:nowrap/*줄바꿈을 하지않음*/

        overflowhidden/*박스 영역 외부 콘텐츠를 감춤*/

        text-overflowellipsis/* 박스 영역 외부 콘텐츠를 ...처리 */

    }

 

</style>

</head>

 

<body>

    <h2>I wanna go home</h2>

    <p>졸리다 집에 갈래</p>

 

    <section>

        <h3>가릴내용</h3>

        <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>

    </section>

</body>

</html>

-------------------------------------

<!DOCTYPE html>

<html lang="ko">

<head>

<meta charset="utf-8">

<title></title>

<style>

* { margin:0padding:0box-sizing:border-box; }

 

.shadow{

    width250pxheight250pxmargin250px auto;

    background:#999;

    border5px solid #36f;border-radius50%;

    box-shadow20px 20px 10px #000,

    inset 20px 20px 10px rgba(2552552550.8), 0 0 10px 20px rgba(0,0,255,0.7);

}

 

</style>

</head>

 

<body>

<div class="shadow"></div>




</body>

</html>

'Coding' 카테고리의 다른 글

CSS 복습/실습  (0) 2021.07.20
CSS 선수학습(8)  (0) 2021.07.19
CSS 선수학습(6)  (0) 2021.07.15
CSS 선수학습(5)  (0) 2021.07.14
CSS 선수학습(4)  (0) 2021.07.14

<!--

※박스 속성

1.너비와 높이(width and)

속성값의 단위: 고정값(px), 가변값(%)

> 너비값: 부모요소는 고정 px사용, 자식요소는 %사용.

> 높이값: 모든 요소에 고정px 사용을 권장한다.

max-width:800px; 이면 박스 크기가 800px 이상 커지지 않는다.

min-width:400px; 이면 박스 크기가 400px 이하로 작아지지 않는다. 

box-sizing:border-box; 는 박스에 width와 height가 적용된 경우에만 적용된다.

 

2.마진과 패딩(margin and padding)

박스에 여백(빈공간)을 지정한다.

마진(margin)은 박스 레이아웃(배치)을 구현하기 위해 사용한다. (음수 값 사용.)

패딩(padding)은 박스의 영역을 확장할 때 사용한다. 글자를 저장한 경우 글자의 위치를 이동한다.

 

3.보더(border)

박스의 테두리를 지정한다. 

border: 두께 스타일 색상 ;

두께는 px단위로 지정한다. 스타일은 solid(선), dashed(점선), dotted(점) 세 가지가 있고 색상은 헥사코드(#000)를 주로 사용한다. 

border-top, border-left, border-bottom, border-right 속성으로 부분만 적용할 수 있다.  

※ border-radius 속성

박스의 모서리를 둥글게 처리한다. 

기본 문법: border-radius:값; > 값(주로 px단위)이 클수록 둥글어진다(4px미만은 잘 적용되지 않는다). 모든 모서리에 적용된다. 

border-top-left-radius /border-top-right-radius /border-bottom-left-radius /border-bottom-right-radius 혹은 border-radius: 값1 값2 값3 값4;를 이용하여 각각 적용 가능. 

border-radius: 값1(top-left&bottom-right) 값2(top-right&bottom-left);

 

4.박스 그림자

box-shadow:값1 2 3 4;

값1>오른쪽 그림자의 거리

2>아래쪽 그림자의 거리

3>번짐의 정도

4>그림자의 색상



-->



<!DOCTYPE html>

<html lang="ko">

<head>

<meta charset="utf-8">

<title>박스 속성</title>

<style>

img {width:500pxmargin-150px 200px 50px 100px/*top right bottom left*/

padding30px 50px/* top, bottom/ left, right*/ 

border5px solid red; }

 

.container { width:100%max-width1400pxmargin:0 autobackground#e2e2e2;}

.box1.box2.box3 { width350pxheight150pxborder1px solid #000}

.box1 { backgroundskyblue;}

.box2 { margin:-50px 0 0 50pxbackgroundlemonchiffon;}

.box3 { margin20px autobackgroundpink;}

 

h2 { margin-top:200pxfont-size42pxtext-aligncentertext-transformuppercase;}

.radius divwidth250pxheight250pxmargin20px autobackground:wheat;}

.rbox1 { border-radius20px;}

.rbox2 { border-radius10px 150px;}

.rbox3 { border-radius30px 80px 130px 180px;}

.rbox4 { border-radius50%;}

.rbox5 { width:300pxheight100pxmargin20px autoborder-radius50pxbackgroundwheat;}

 

.shadow { backgroundthistle;}

.shadow .sbox1.shadow .sbox2.shadow .sbox3.shadow .sbox4.shadow .sbox5 , .shadow .sbox6 , .shadow .sbox7 , .shadow .sbox8  { width300pxheight150pxmargin25px autobackgroundindianred;}

.shadow .sbox1 { box-shadow10px 10px 10px cornflowerblue; }

.shadow .sbox2 { box-shadowinset 0 5px 15px cornflowerblue; }

.shadow .sbox3 { box-shadowinset 0 0 30px cornflowerblue; }

.shadow .sbox4 { box-shadow-5px -5px 0 cornflowerblue; }

.shadow .sbox5 { box-shadow0 10px 15px cornflowerblue; }

.shadow .sbox6 { box-shadow0 0 0 20px cornflowerblue; }

.shadow .sbox7 { box-shadowinset -10px -10px 25px cornflowerblue; }

.shadow .sbox8 { box-shadowinset 0 0 0 20px rgba(0000.3); transitionall 0.4s ease-in; }

.shadow:hover .sbox8 {box-shadowinset 0 0 0 5px rgba(25525525506);}

 

.circle {

    positionrelative;

    width300pxheight300pxmargin150px auto

    backgroundturquoiseborder-radius50%;

    box-shadowinset 0 0 0 30px rgba(2552552550.4), 0 0 0 2px rgba(0,0,0,0.8); 

    transition:all 0.4s ease-in;

}

.child {

    positionabsoluteleft30pxtop:30px;

    width240pxheight240px

    backgroundrgba(0000.3); border-radius50%z-index9;

    transition:all 0.4s ease-out 0.2s;

}

.circle p {

    position:absoluteleft50%top:50%;

    width150pxheight50px

    margin-25px 0 0 -75pxpadding0z-index10;

    font-size42pxcolor#ffftext-align:centerline-height:42pxtext-transform:uppercase;

 

}

 

.circle:hover {

    box-shadowinset 0 0 0 2px rgba(0000.5);

}

.circle:hover .child {left:10pxtop:10pxwidth280pxheight280px;}

 

.circle:hover p { color:#000; }

 

 </style>

 

</head>

 

<body>

 <img src="./imgs/photo1.jpg" alt="삽화" >

 

 <div class="container">

    <div class="box1">box1</div>

    <div class="box2">box2</div>

    <div class="box3">box3</div>

</div>

 

    <h2>BORDER-RADIUS</h2>

    <div class="radius">

        <div class="rbox1"></div>

        <div class="rbox2"></div>

        <div class="rbox3"></div>

        <div class="rbox4"></div>

        <p class="rbox5"></p>

    </div>

    

    <h2>box-shadow</h2>

    <div class="shadow">

        <div class="sbox1"></div>

        <div class="sbox2"></div>

        <div class="sbox3"></div>

        <div class="sbox4"></div>

        <div class="sbox5"></div>

        <div class="sbox6"></div>

        <div class="sbox7"></div>

        <div class="sbox8"></div>

    </div>

 

    <div class="circle">

        <div class="child"></div>

        <p>css3</p>

    </div>

</body>

</html>

'Coding' 카테고리의 다른 글

CSS 선수학습(8)  (0) 2021.07.19
CSS 선수학습(7)  (0) 2021.07.16
CSS 선수학습(5)  (0) 2021.07.14
CSS 선수학습(4)  (0) 2021.07.14
CSS 선수학습(3)  (0) 2021.07.13

+ Recent posts