[Day2] CSS 2 [11/10]

 

   1. CSS ์„ ํƒ์ž(selector)

       1) ๋‹จ์ˆœ ์„ ํƒ์ž - ํƒœ๊ทธ๋ช… < ํด๋ž˜์Šค๋ช…  < ID๋ช…(์ˆซ์ž๋กœ ์‹œ์ž‘ X) 

                               ์„ ํƒ์ž ์ ์ˆ˜ ๋†’์œผ๋ฉด ์šฐ์„  ์ˆœ์œ„๊ฐ€ ๋†’๋‹ค. ( ์ ์ˆ˜ ๊ณ„์‚ฐ ) 

       2) ๊ฒฐํ•ฉ์ž ์„ ํƒ์ž - div p,  div > p,       div + p,           div ~ p

                                     ํ›„์†      ์ง๊ณ„์ž์‹     ํ˜•์ œ๋ ˆ๋ฒจ

                                   ํŠน์ • ๊ด€๊ณ„๋ฅผ ๊ฐ€์ง„ ์š”์†Œ    

       3) ์œ ์‚ฌ ํด๋ž˜์Šค ์„ ํƒ์ž - ํŠน์ • ์ƒํƒœ๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์š”์†Œ ์„ ํƒ

                                     p:hover{}

                                     :์˜์‚ฌ ํด๋ž˜์Šค

       4) ์œ ์‚ฌ ์š”์†Œ ์„ ํƒ์ž  - ์š”์†Œ์˜ ์ง€์ •๋œ ๋ถ€๋ถ„์— ์Šคํƒ€์ผ์„ ์ง€์ •ํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ. 

                                     ::์˜์‚ฌ์š”์†Œ

                                     ์š”์†Œ์˜ ๋‚ด์šฉ  ์•ž , ๋’ค์— ๋‚ด์šฉ ์‚ฝ์ž…

<div id="section">
  float:left
  <div></div>
  <div></div>
</div>                                     
#section::after{
  content:"";
  clear:both;
  display:table;
}
<!-- <div style="clear: both"></div> -->
<div id="footer"></div>

       5) ์†์„ฑ ์„ ํƒ์ž  - [์†์„ฑ=์†์„ฑ๊ฐ’]

[type='button']             ->           :button(jquery selector)
[class*='col-']
[class|='col-']
[class^='col-']
[class$='col-']
[class~='col-']

    2. CSS ์ ์šฉํ•˜๋Š” ๋ฐฉ๋ฒ•

       1) ๋‚ด๋ถ€(Internal) css ์ ์šฉ๋ฐฉ๋ฒ• - ํ•ด๋‹น ํŽ˜์ด์ง€

       2) ์ธ๋ผ์ธ( Inline)css ์ ์šฉ๋ฐฉ๋ฒ• - ํ•ด๋‹น ์š”์†Œ

            ๋‚ด,์™ธ css ์ ์šฉ๋ฐฉ๋ฒ• + ์ธ๋ผ์ธ ( ์žฅ์  X )

       3) ์™ธ๋ถ€( External)   css ์ ์šฉ๋ฐฉ๋ฒ• - ์›น ์‚ฌ์ดํŠธ ์ „์ฒด( ์—ฌ๋Ÿฌ ํŽ˜์ด์ง€ )

              ใ„ฑ.  ์™ธ๋ถ€ํŒŒ์ผ๋ช….css

               ใ„ด. <link href="~.css" rel="stylesheets">

 

 

    3. ์ฐธ๊ณ   

        ์†์„ฑ๊ฐ’๊ณผ ๋‹จ์œ„ ์‚ฌ์ด์— ๊ณต๋ฐฑ ์ถ”๊ฐ€ X

        font-size :   20 px     


์Šคํƒ€์ผ ์ˆœ์„œ

์ธ๋ผ์ธ > ๋‚ด๋ถ€ = ์™ธ๋ถ€ (์ด๊ฑด ์ˆœ์„œ๋Œ€๋กœ) > ์—†์œผ๋ฉด ๋ธŒ๋ผ์šฐ์ € ๊ธฐ๋ณธ๊ฐ’ ์ ์šฉ

 

์ฃผ์„์ฒ˜๋ฆฌ

html ์ฃผ์„์ฒ˜๋ฆฌ                                 <!--  -->
css ์ฃผ์„์ฒ˜๋ฆฌ                                   /*    */
javascript(js) ์ฃผ์„์ฒ˜๋ฆฌ                  //                 /*   */
jsp ์ฃผ์„์ฒ˜๋ฆฌ                                   <%--  --%>

์ƒ‰์ƒ

1) ๋ฏธ๋ฆฌ ์ •์˜๋œ ์ƒ‰์ƒ๋ช… ( ํ‘œ์ค€ ์ƒ‰์ƒ ์ด๋ฆ„ - 140๊ฐœ ) 

background-color: Tomato;

      

2) RGB(0~255, 0~255, 0~255)             red/green/blue ์ƒ‰์˜ 3์›์†Œ

background-color: rgb(0, 0, 0);

color:rgb(255,255,255);

      

3) #16์ง„์ˆ˜     == #fff

color:#ffffff; 

color:#0000ff;

      

4) RGBA(0~255, 0~255, 0~255,  Alpha  ํˆฌ๋ช…๋„  0.0 ~ 1.0 )

background-color: rgb(0, 0, 0, 0.4);

       

5) HSL()       hue(์ƒ‰์กฐ)  Saturation(์ฑ„๋„)   Lightness(๋ฐ๊ธฐ)

background-color: hsl( 0, 100%, 50%);

 

6. HSLA()


    [ css ๋ฐฐ๊ฒฝ ]

    1. ๋ฐฐ๊ฒฝ์ƒ‰

  body{
     /* 1. ๋ฐฐ๊ฒฝ์ƒ‰ */
     background-color: lightblue;
  }
  
  h3{
    background-color: yellow;
  }
  
  div{
    border:1px solid gray;
    width:200px;
    padding: 10px;
    background-color: rgba(0, 255, 0,  0.1);
  }
  
  div.first{
     /* opacity ์†์„ฑ์œผ๋กœ ํˆฌ๋ช…๋„๋ฅผ ์„ค์ •ํ•˜๋ฉด ์ž์‹(ํ•˜์œ„)์š”์†Œ๋„ ๋™์ผํ•œ ํˆฌ๋ช…๋„๋ฅผ ์ƒ์†ํ•œ๋‹ค. */
     opacity: 0.5;
  }

    2. ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€  ex04_02.html

    3. ๋ฐฐ๊ฒฝ ๋ฐ˜๋ณต( repeat )

    4. ๋ฐฐ๊ฒฝ ์ฒจ๋ถ€

    5. ๋ฐฐ๊ฒฝ ์œ„์น˜

<style>
body {
	background-color: red;
	/* paper.gif  67 * 56 */
	/* ์ด๋ฏธ์ง€๋Š” ์ „์ฒด ์š”์†Œ(body)๋ฅผ ์ž๋™ ๊ฐ€๋กœ/์„ธ๋กœ ๋ฐ˜๋ณต  */
	/* (์ฃผ์˜) ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€- ํ…์ŠคํŠธ ์ƒ‰์ƒ ๊ณ ๋ ค */
	/* ๋ฐฐ๊ฒฝ์ƒ‰  X */
	/* background-image: url('../images/paper.gif'); */
	background-image: url('../images/img_tree.png');
	/* background-repeat: repeat-x; */
	/* background-repeat: repeat-y; */
	background-repeat: no-repeat;
	background-position: right top;
	
	background-attachment: fixed;
}
</style>

    6. ๋ฐฐ๊ฒฝ ์•ฝ์‹ ์†์„ฑ  

<style>
body {
	/* 6. ๋ฐฐ๊ฒฝ ์•ฝ์‹ ์†์„ฑ  color image repeat attachment  position */
	/* background: red  url('../images/img_tree.png')  no-repeat fixed right top ; */
	background:  url('../images/img_tree.png')  no-repeat fixed right top ;
	
	/* 
	background-color: red;
	background: red;
	 */
}
</style>

top - ํŽ˜์ด์ง€ ์ œ์ผ ์œ„๋กœ

<style>
   #top{
     /* 
      border-width:1px;
      border-style: solid;
      border-color: gray;
       */
       
       /* ํ…Œ๋‘๋ฆฌ ์•ฝ์‹ ์†์„ฑ */
       border:1px solid gray;
       width: 25px;
       height: 25px;
       
       position: fixed;
       right:5px;
       bottom: 5px;
  }
  
  /* :์˜์‚ฌํด๋ž˜์Šค  - ํŠน์ •์ƒํƒœ */
  #top:hover{
    background-color: black;
    color:yellow;
    font-weight: bold;
    cursor: pointer;    /* ์†๊ฐ€๋ฝ ๋ชจ์–‘ */
  }
</style>

body

	<!-- #top>{top}+(h3>{css ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€})+lorem+p*50>{.} -->
	<div id="top"  onclick="top_click();">top</div>
	<h3>css ๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง€</h3>
	Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vel inventore
	vitae molestias tenetur quam minus perferendis ea ratione perspiciatis
	aut. At delectus cumque voluptatem dolorum iste error quasi quia
	doloremque.
	<p>.</p>
	<p>.</p>
	<p>.</p>
	<p>.</p>
	<p>.</p>
	<p>.</p>
	<p>.</p>
	<p>.</p>
<script>
   function top_click(){
	   // alert("์ด๋ฒคํŠธ ํ™•์ธ!!!@")
	   // ๋ธŒ๋ผ์šฐ์ € ์ข…๋ฅ˜์— ๋”ฐ๋ผ ๋‹ค๋ฆ„ -> ํฌ๋กœ์Šค ๋ธŒ๋ผ์šฐ์ง•
	   document.body.scrollTop = 0;
	   document.documentElement.scrollTop = 0;
   }
</script>

ํ…Œ๋‘๋ฆฌ ์Šคํƒ€์ผ

<style>
   h3{
       /* ํ…Œ๋‘๋ฆฌ ์ƒ‰์ƒ */
       /* border-color: red;       */ 
       /* ํ…Œ๋‘๋ฆฌ ๋„ˆ๋น„ */
       /* border-width: 1px; */       
       
       /* ํ…Œ๋‘๋ฆฌ ์Šคํƒ€์ผ ( ํ•„์ˆ˜ ) ์„ ์ง€์ •ํ•˜์ง€ ์•Š์œผ๋ฉด width, color ์ ์šฉ๋˜์ง€ ์•Š๋Š”๋‹ค. */
       /* border-style: solid; */
       
      background-color: #ddffff;
      /* border */
      /* border-top: */
     border-left:6px solid #2196f3;  
      /* border-right:  */
      /* border-bottom:  */
      padding: 15px;
      
      /* ๋‘ฅ๊ทผ ํ…Œ๋‘๋ฆฌ */
      border-radius: 5px;
   }
</style>

<style>
   div{
     border:2px solid red;
     padding: 10px;
     
    /*  border-radius: 7px; */
    border-top-left-radius: 15px;
    border-bottom-right-radius: 15px;
   }
</style>
<p style="border-style: dotted;">์ ์„  ํ…Œ๋‘๋ฆฌ</p>
<p style="border-style: dashed;">์ ์„  ํ…Œ๋‘๋ฆฌ</p>
<p style="border-style: solid;">์‹ค์„  ํ…Œ๋‘๋ฆฌ</p>
<p style="border-style: double;">์ด์ค‘ ํ…Œ๋‘๋ฆฌ</p>
<p style="border-style: groove;">3D ํ™ˆ ํ…Œ๋‘๋ฆฌ</p>
<p style="border-style: ridge;">3D ์œต๊ธฐ๋œ ํ…Œ๋‘๋ฆฌ</p>
<p style="border-style: inset;">3D ์‚ฝ์ž… ํ…Œ๋‘๋ฆฌ</p>
<p style="border-style: outset;">3D ์•„์›ƒ์…‹ ํ…Œ๋‘๋ฆฌ</p>
<p style="border-style: hidden;">์ˆจ๊ฒจ์ง„ ํ…Œ๋‘๋ฆฌ</p>
<p style="border-style: none;"> ํ…Œ๋‘๋ฆฌ ์ •์˜ X</p>

margin

  1. ํ…Œ๋‘๋ฆฌ ์™ธ๋ถ€ - ๋งˆ์ง„(์—ฌ๋ฐฑ)  

      ํ…Œ๋‘๋ฆฌ ๋‚ด๋ถ€ - ํŒจ๋”ฉ

   2. margin ์†์„ฑ

       margin-top

       margin-right

       margin-bottom

       margin-left

       margin

   3. ์—ฌ๋ฐฑ ์†์„ฑ๊ฐ’ 

        1) auto - ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ์—ฌ๋ฐฑ์„ ์ž๋™ ๊ณ„์‚ฐ

        2) ๊ธธ์ด ๋‹จ์œ„ - px, pt, cm ๋“ฑ๋“ฑ

        3) % - ์š”์†Œ๋ฅผ ํฌํ•จํ•˜๋Š” ๋ถ€๋ชจ์š”์†Œ์˜ ๋„ˆ๋น„์˜  %

        4) ์ƒ์† -  ๋ถ€๋ชจ ์š”์†Œ ( ์—ฌ๋ฐฑ) -> ์ž์‹ ์š”์†Œ (์—ฌ๋ฐฑ)

 

<style>
  body{
     padding: 0;
     margin: 0;
  }
  div{
     border: 1px solid black;
     /*
     margin-top: 25px;
     margin-right: 50px;
     margin-bottom: 75px;
     margin-left: 100px;
     */
     /* ์•ฝ์‹ ์†์„ฑ  top right bottom left ์ˆœ์„œ   ์‹œ๊ณ„๋ฐฉํ–ฅ */
     /* margin:  25px 50px  75px  100px; */
     /* 
     margin:25px 25px 25px 25px;
     margin:25px;
     */
     /* 
            t/b  l/r
     margin:25px 100px;
     */
     /* ๊ฐ€์šด๋ฐ ์ •๋ ฌ */
     /* margin: 0     auto; */
       
     /*         top  l/r   bottom */
     /*  margin:25px 75px  100px; */
  }
</style>

 

*์ฃผ์˜) margin ์ค‘๋ณต๋จ (๋”ฐ๋กœ ๊ณ„์‚ฐ๋˜์ง€ ์•Š์Œ) 

     [ ์—ฌ๋ฐฑ ์ถ•์†Œ๋œ ๊ฒฝ์šฐ ]
    bottom    ์—ฌ๋ฐฑ 75px
    top           ์—ฌ๋ฐฑ 25px
                     100px (X)  -> 75px  (O)

 

์—ฌ๋ฐฑ margin ( inherit ์ƒ์† )

<style>
  div{
    border: 1px solid red;
    margin-left: 50px;
  }
  
  p.ex1{
     border:1px solid blue;
     margin-left: inherit;
  }
</style>

padding 

  1. ํ…Œ๋‘๋ฆฌ  -[๊ฐ„๊ฒฉ]-   ๋‚ด์šฉ(conetnt)

  2. 

       padding-top

       padding-right

       padding-bottom  

       padding-left

 

  3. ๋‹จ์œ„ : px, %, pt, cm ๋“ฑ๋“ฑ    inherit  ( ์Œ์ˆ˜ ํ—ˆ์šฉ X ) 

<style>
    div{
        border: 1px solid black;
        background: lightblue;
        
        /* 
        padding-top: 50px;
        padding-right: 50px;
        padding-bottom: 50px;
        padding-left: 50px;
         */
         /* padding:50px 50px 50px 50px; */         
         /* padding:50px; */
         
                       /* t/b       l/r */
         /* padding:25px 50px; */
         
                        /* t     l/r    b */
         padding:25px 50px 75px;
    }
</style>

  4. ์ฃผ์˜) 

           padding ์†์„ฑ +  width ์†์„ฑ ์˜ํ–ฅ์„ ๋ผ์นœ๋‹ค. 

           ex07_02.html

<style>
   div{
      width: 300px;      
   }
   div.ex1{
      border: 1px solid red;
   }
   div.ex2{
      border: 1px solid blue;
      padding: 10px;
      border-width: 20px; 
   }

</style>
<h3>ex07_02.html -   padding & width</h3>

<div class="ex1">div.ex1 - width:300px</div>

์‹ค์ œ ๋„ˆ๋น„ = width(300) + padding(10) * 2 + ํ…Œ๋‘๋ฆฌ(20) * 2 = 360px 
<div class="ex2">div.ex2 - width:300px</div>

 

 * padding, border -> width ์†์„ฑ๊ฐ’ ์œ ์ง€ , content  ๋„ˆ๋น„ ์ถ•์†Œ

   *{
     box-sizing: border-box;
   }

width(๋„ˆ๋น„), height(๋†’์ด)

    1. width, height ์†์„ฑ์—๋Š” ํŒจ๋”ฉ, ํ…Œ๋‘๋ฆฌ, ์—ฌ๋ฐฑ ์ด ํฌํ•จ๋˜์ง€ ์•Š๋Š”๋‹ค. 

    2. ๋‹จ์œ„ : auto( ๋ธŒ๋ผ์šฐ์ € ์ž๋™ ๊ณ„์‚ฐ)

              , px, cm ๋“ฑ๋“ฑ

              , %

              , inherit ๋ถ€๋ชจ๊ฐ’์„ ์ƒ์†

              , initial - ๊ธฐ๋ณธ๊ฐ’ ์„ค์ •. 

<style>
   div{
      width: 50%;
      max-width:500px;   /* ์ตœ๋Œ€ ๋„ˆ๋น„  */
      
      height: 200px;
      background-color: lightblue;
   }
</style>
<div>๋„ˆ๋น„ 50%, ๋†’์ด 200px</div>

* max-width ์†์„ฑ์„ ์„ค์ •ํ•˜์ง€ ์•Š์€ ๊ฒฝ์šฐ์—๋Š” ์ตœ๋Œ€ ๋„ˆ๋น„๊ฐ€ ์—†์Œ


width, max-width, min-width ์†์„ฑ

div{
    background: lightblue;
    
    /* 
    ๊ณ ์ • ๋„ˆ๋น„์ด๊ธฐ์—   ๋ธŒ๋ผ์šฐ์ € ํฌ๊ธฐ 500 ๋ณด๋‹ค ์ž‘๊ฒŒ ํ•˜๋ฉด ์ž๋™์œผ๋กœ ์Šคํฌ๋กค๋ฐ” ์ƒ๊ธฐ๋”๋ผ.
    width:500px;
     */
    
    /* ๋ธŒ๋ผ์šฐ์ € ํฌ๊ธฐ 500 ๋ณด๋‹ค ์ž‘๊ฒŒ ํ•˜๋ฉด ์ž๋™์œผ๋กœ div ๋„ˆ๋น„ ์ค„์–ด๋“ ๋‹ค.. */
    max-width:500px;  /* ์ตœ๋Œ€๋„ˆ๋น„ */
    min-width:250px;   /* ์ตœ์†Œ๋„ˆ๋น„ */
    
    height: 100px;
    /* 
    max-height: ;  ์ตœ๋Œ€ ๋†’์ด
    min-height:    ์ตœ์†Œ ๋†’์ด
     */
}
<div>box</div>

box model

<style>
  pre{
     border: 15px solid green;
     padding: 50px;
     margin: 20px;
     width:300px;
  }
</style>

   1. ๋””์ž์ธ, ๋ ˆ์ด์•„์›ƒ.. 

   2. 

                                                       ํŒจ๋”ฉ

                                                          +

                       ์—ฌ๋ฐฑ + ํ…Œ ๋‘๋ฆฌ+ํŒจ๋”ฉ +๋‚ด์šฉ(content)+ํŒจ๋”ฉ+ํ…Œ๋‘๋ฆฌ + ์—ฌ๋ฐฑ

                                                             +

                                                         ํŒจ๋”ฉ   

   3.

     ๋ฐ•์Šค ์ด ๋„ˆ๋น„ = ์—ฌ๋ฐฑ + ํ…Œ๋‘๋ฆฌ+ํŒจ๋”ฉ + ๋‚ด์šฉ(content)+ ํŒจ๋”ฉ + ํ…Œ๋‘๋ฆฌ + ์—ฌ๋ฐฑ      

                        =  20   +   15    + 50  + 300               +  50  +   15      +  20

                        =                  ???

      ๋ฐ•์Šค ์ด ๋†’์ด = ์—ฌ๋ฐฑ + ํ…Œ๋‘๋ฆฌ+ํŒจ๋”ฉ +๋‚ด์šฉ(content)+ํŒจ๋”ฉ+ํ…Œ๋‘๋ฆฌ + ์—ฌ๋ฐฑ  

 

-> padding, border -> width ์†์„ฑ๊ฐ’ ์œ ์ง€ , content  ๋„ˆ๋น„ ์ถ•์†Œ : box-sizing: border-box;


์œค๊ณฝ์„ (outline) - ์š”์†Œ์˜ ํ…Œ๋‘๋ฆฌ ์™ธ๋ถ€์— ๊ทธ๋ ค์ง€๋Š” ์„ .

<style>
   div{
      border: 1px solid red;
      padding: 10px;
      margin:auto;
      
      outline:1px solid blue;
      
      /* border    + ๊ฐ„๊ฒฉ +     outline */
      outline-offset:15px;
      
      /* 
      outline ์•ฝ์‹์†์„ฑ
      outline-color
      outline-style           ์Šคํƒ€์ผ ์†์„ฑ์„ ์ง€์ •ํ•˜์ง€ ์•Š์œผ๋ฉด  ์•„๋ฌด ํšจ๊ณผ ์—†๋‹ค. 
      outline-width
      outline-offset
       */
   }
</style>

 - ํ…Œ๋‘๋ฆฌ์™€ outline ๊ฐ„๊ฒฉ์ฃผ๊ณ ์žํ• ๋•Œ  : outline-offset  


ํ…์ŠคํŠธ(text)

<style>
   body {
	   /* 1. ๊ธ€์ž(ํ…์ŠคํŠธ) ์ƒ‰์ƒ */
	   color: blue;   /*  # , rgb() , ์ƒ‰์ƒ๋ช… */
   }
   
   h3{
       color:green;
       /* 2. ํ…์ŠคํŠธ ์ •๋ ฌ */
       /* text-align: center; */
       text-align: justify;
   }
   
  p#p1{
      border:1px solid gray;
      /* text-align: justify; */
      /* justify : ์‚ฌ์ „์ ์˜๋ฏธ - ํƒ€๋‹น์„ฑ์„ ๋ณด์—ฌ์ฃผ๋‹ค, ์ •๋‹นํ™”์‹œํ‚ค๋‹ค, ํ•ด๋ช…ํ•˜๋‹ค.
                    ์ธ์‡„๋˜๋Š” ํ…์ŠคํŠธ์˜ ํ–‰์˜ ๋์„ ๋‚˜๋ž€ํžˆ ๋งž์ถ”๊ฒ ๋‹ค. */
      /* ํ…์ŠคํŠธ์˜ ๋งˆ์ง€๋ง‰ ์ค„์„ ์ •๋ ฌ */              
      text-align-last:right;                
  }
  
  div{
     /* 3. ํ…์ŠคํŠธ ๋ฐฉํ–ฅ ๋ณ€๊ฒฝ */
     direction: rtl;
  }
   
   /* 4. ํ…์ŠคํŠธ์—์„œ ์ด๋ฏธ์ง€์˜ ์ˆ˜์ง ์ •๋ ฌ ์„ค์ • */
   /* algin  ์ˆ˜ํ‰ ์ •๋ ฌ */
   img.a{  vertical-align: baseline; } /*  ๊ธฐ๋ณธ๊ฐ’ */
   img.b{vertical-align: text-top; }
   img.c{vertical-align: text-bottom; }
   img.d{vertical-align: sub; }
   img.e{vertical-align:super; }
</style>
<body>
<h3>ex11.html - ํ…์ŠคํŠธ(text)</h3>

<!-- div>lorem5 -->
<div>Lorem ipsum dolor sit amet.</div>

<!-- p#p1>lorem -->
<p id="p1">
Lorem ipsum dolor sit amet, consectetur adipisicing elit.
 Praesentium architecto a explicabo nobis quaerat veritatis 
 quia autem placeat inventore magnam ad provident nesciunt
  excepturi ea officia aliquid aut dolorum recusandae!
</p>

<!-- p*5>lorem5 -->
<p>Lorem <img src="../images/sqpurple.gif" class="a" style="width: 9px;height: 9px;"> ipsum dolor sit amet.</p>
<p>Totam <img src="../images/sqpurple.gif" class="b" style="width: 9px;height: 9px;">beatae officia voluptas a.</p>
<p>Iste <img src="../images/sqpurple.gif" class="c" style="width: 9px;height: 9px;">consectetur minima eos quod.</p>
<p>Aliquam <img src="../images/sqpurple.gif" class="d" style="width: 9px;height: 9px;">culpa inventore eum repellendus.</p>
<p>Hic <img src="../images/sqpurple.gif" class="e" style="width: 9px;height: 9px;">dolores dicta ab suscipit.</p>

<script>
</script>
</body>

* <p style="text-align:justify; width:200">์ž๋™ ์ค„๋ฐ”๊ฟˆ์‹œ ์˜ค๋ฅธ์ชฝ ๊ฒฝ๊ณ„์„  ๋ถ€๋ถ„์ด ์ •๋ฆฌ๋ฉ๋‹ˆ๋‹ค. 


๋งํฌํƒœ๊ทธ

ํ…์ŠคํŠธ๊ฐ„์˜ ๊ฐ„๊ฒฉ

<style>
   /* 
   a{}
   a:hover{}         :์˜์‚ฌํด๋ž˜์Šค
   */
   
   /* ๋งํฌํƒœ๊ทธ 4๊ฐ€์ง€ ์ƒํƒœ  (์ฃผ์˜: ์ˆœ์„œ ์ง€์ผœ์„œ ์ฝ”๋”ฉ.)  */
   a:link{     /* ๋ฐฉ๋ฌธ์ง€ ์•Š์€ ์ƒํƒœ์˜ ๋งํฌ */
     color:black;
     text-decoration: none;
   }
   a:visited{   /* ๋ฐฉ๋ฌธํ•œ ์ƒํƒœ์˜  ๋งํฌ */
      color:green;
   }
   a:hover{   /* ๋งˆ์šฐ์Šค ๋งํฌ์— ์˜ฌ๋ฆฐ ์ƒํƒœ */
      color:hotpink;
      /* text-decoration: underline overline line-through; */
      
      /* text-transform: uppercase;  ๋Œ€๋ฌธ์ž ๋ณ€ํ™˜*/
      /* text-transform: lowercase;  ์†Œ๋ฌธ์ž ๋ณ€ํ™˜*/      
      text-transform: capitalize;  /*  ๊ฐ ๋‹จ์–ด์˜ ์ฒซ ๊ธ€์ž๋ฅผ ๋Œ€๋ฌธ์ž๋กœ ๋ณ€ํ™˜ */
   }
   a:active{     /* ๋งํฌ๋ฅผ ํด๋ฆฌํ•˜๋Š” ์ˆœ๊ฐ„์˜ ์ƒํƒœ */
   }
</style>
<body>
<h3>ex11_02.html - css ํ…์ŠคํŠธ ์žฅ์‹ : text-decoration </h3>
<h3>ex11_02.html - css ํ…์ŠคํŠธ ๋ณ€ํ™˜ :text-transform </h3>

<!-- a[href=#]*3>lorem1 -->
<a href="#">lorem.</a><br>
<a href="#">itaque.</a><br>
<a href="#">illo.</a><br>

<h3  style="letter-spacing: 10px">ํ…์ŠคํŠธ ๊ฐ„์˜ ๊ฐ„๊ฒฉ</h3>
<pre>
  1. text-indent ์†์„ฑ  : ์ฒซ ๋ฒˆ์งธ ๋ผ์ธ์— ๋“ค์—ฌ์“ฐ๊ธฐ
  2. letter-spacing ์†์„ฑ : ๋ฌธ์ž์™€ ๋ฌธ์ž ์‚ฌ์ด์˜ ๊ฐ„๊ฒฉ
  3. line-height ์†์„ฑ      : ๋ผ์ธ๊ณผ ๋ผ์ธ ์‚ฌ์ด์˜ ๊ฐ„๊ฒฉ
  4. word-spacing ์†์„ฑ  : ๋‹จ์–ด์™€ ๋‹จ์–ด ์‚ฌ์ด์˜ ๊ฐ„๊ฒฉ
  5. white-spacing (๊ณต๋ฐฑ)์†์„ฑ           - ex11_03.html
  6. word-break ์†์„ฑ               - ex11_04.html
  7. word-wrap ์†์„ฑ
</pre>
<!-- p*3>lorem7 -->
<p style="text-indent: 50px;line-height: 0.5">
Lorem ipsum dolor sit amet, consectetur 
adipisicing elit. Consectetur odio dolores quidem ullam accusamus
 cum ab temporibus assumenda fugiat adipisci. Quos consectetur 
 molestias dignissimos officiis exercitationem recusandae temporibus 
 ratione aperiam.
 </p>
<p style="word-spacing: 10px">Tenetur commodi quam doloribus maiores beatae animi!</p>
<p>Ab culpa provident aut voluptatibus debitis fugit.</p>

<script>
</script>
</body>

5. white-spacing (๊ณต๋ฐฑ)์†์„ฑ 

    p{
       border: 1px solid gray;
       width:500px;
       margin: 0 auto;   /* ๊ฐ€์šด๋ฐ ์ •๋ ฌ */
       
       /* white-space ์†์„ฑ : ์š”์†Œ ๋‚ด๋ถ€์˜ ๊ณต๋ฐฑ์„ ์ฒ˜๋ฆฌํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ์ง€์ •ํ•˜๋Š” ์†์„ฑ */
       /* nowrap ๊ฐ’:  ์š”์†Œ ๋‚ด๋ถ€์˜ ํ…์ŠคํŠธ ์ค„ ๋ฐ”๊ฟˆ์„ ์ž๋™ ๊ฐœํ–‰ ํ•˜์ง€๋ง๋ผ( ๋น„ํ™œ์„ฑํ™” )*/
       white-space:nowrap;
    }

6. word-break ์†์„ฑ

7. word-wrap ์†์„ฑ

   p{
       border: 1px solid gray;
       width:200px;
       
      
        /* ๊ธด ๋‹จ์–ด๋ฅผ ๋Š๊ณ  ๋‹ค์Œ ๋ผ์ธ์œผ๋กœ ์ค„๋ฐ”๊ฟˆ */
        word-wrap:break-word;   
                 
        /* ๋ผ์ธ ๋์— ๋„๋‹ฌํ•  ๋•Œ ๋‹จ์–ด๊ฐ€ ๋Š์–ด์ง€๋Š” ๋ฐฉ์‹ ์ง€์ • */
        word-break:break-all; 
    }

ํ…์ŠคํŠธ ๊ทธ๋ฆผ์ž

  h1{
    /* ํ…์ŠคํŠธ์— ๊ทธ๋ฆผ์ž๋ฅผ ์ถ”๊ฐ€ํ•˜๋Š” ์†์„ฑ */
                   /* ๊ฐ€๋กœx์œ„์น˜  ์„ธ๋กœy์œ„์น˜ */
    /* text-shadow: 2px 2px; */
    
    /* ๊ทธ๋ฆผ์ž ์ƒ‰์ƒ */
    /* text-shadow: 2px 2px red; */
    
     /* ๊ทธ๋ฆผ์ž์— ํ๋ฆผ ํšจ๊ณผ(5px) */
    /* text-shadow: 2px 2px  5px red; */
    
    
    text-shadow: 0 0 3px #ff0000, 0 0 5px #0000ff;
  }

๊ธ€๊ผด

  1. css ๊ธ€๊ผด(font)์€ ์›น์‚ฌ์ดํŠธ์— ์ ํ•ฉํ•œ ๊ธ€๊ผด์„ ์„ ํƒํ•˜๋Š” ๊ฒƒ์ด ์ค‘์š”ํ•˜๋‹ค.

  2. ์ฝ๊ธฐ ์‰ฌ์šด ๊ธ€๊ผด, ์ƒ‰์ƒ, ํฌ๊ธฐ ์„ ํƒ ์ค‘์š”.. 

  3. ์›น ์•ˆ์ „ ๊ธ€๊ผด - ๋ชจ๋“  ๋ธŒ๋ผ์šฐ์ €/์žฅ์น˜์—์„œ ๋ณดํŽธ์ ์œผ๋กœ ์„ค์น˜๋˜์–ด ์žˆ๋Š” ๊ธ€๊ผด.

   p{
      /* font:  ์•ฝ์‹ ์†์„ฑ */
      
     font-family: Arial, "Verdana", "Times New Roman";

      */
     font-size: 2.5em;   /* 16px * 2.5 == 35px */
     
     font-weight: bold;
     
     font-style: italic;     /* <i></i> */
     font-variant: small-caps;    /*  ๋ชจ๋“  ์†Œ๋ฌธ์ž๋“ค์„  ์ž‘์€ ๋Œ€๋ฌธ์ž ๋ณ€ํ™˜*/
     
               /* sytle  variant weight size family */
     /* font:italic small-caps bold 2.5em Arial, "Verdana", "Times New Roman"; */
  }

     
     - ํ…์ŠคํŠธ์˜ ํฌ๊ธฐ , ์ ˆ๋Œ€์™€ ์ƒ๋Œ€ ํฌ๊ธฐ(์ฃผ๋ณ€ ์š”์†Œ ๊ธฐ์ค€, ์‚ฌ์šฉ์ž ๋ธŒ๋ผ์šฐ์ €์—์„œ ํ…์ŠคํŠธ ํฌ๊ธฐ ๋ณ€๊ฒฝ.) 
     - ๋ธŒ๋ผ์šฐ์ € ๋ฉ”๋‰ด์—์„œ ํ…์ŠคํŠธ ํฌ๊ธฐ๋ฅผ ์กฐ์ •ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๊ธฐ ์œ„ํ•ด์„œ ๊ฐœ๋ฐœ์ž๊ฐ€ ํ”ฝ์…€ ๋‹จ์œ„ ๋Œ€์‹ ์— em ๋‹จ์œ„๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. 
     
     - ๋ธŒ๋ผ์šฐ์ €์˜ ๊ธฐ๋ณธ ํ…์ŠคํŠธ ํฌ๊ธฐ๋Š” 16px ์ด๋‹ค. 
     - 16px == 1em

 

 

 1.   html์—์„œ ํ‘œ์ค€ ๊ธ€๊ผด์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š์œผ๋ ค๋ฉด "๊ตฌ๊ธ€ ๊ธ€๊ผด""์„ ์‚ฌ์šฉํ•  ์ˆ˜๋„ ์žˆ๋‹ค.

 2. ๊ตฌ๊ธ€ ๊ธ€๊ผด - ๋ฌด๋ฃŒ,   1000๊ฐœ ์ด์ƒ ๊ธ€๊ผด 

 

<!-- ์—ฌ๋Ÿฌ ๊ธ€๊ผด์„ ๊ตฌ๊ธ€ ์š”์ฒญํ•˜๋ฉด ์›น ํŽ˜์ด์ง€ ์†๋„๋Š” ๋–จ์–ด์ง„๋‹ค. -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Sofia">

<style>
   body{
       font-family: "Sofia", sans-serif;
   }
</style>

์•„์ด์ฝ˜ ์ถ”๊ฐ€.

   1. ๊ฐ€์žฅ ๊ฐ„๋‹จํ•œ ๋ฐฉ๋ฒ• ์•„์ด์ฝ˜ ์‚ฌ์šฉ. - font awesome ์•„์ด์ฝ˜ ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ ์‚ฌ์šฉ.

        fontawesome.com ( ํฐํŠธ์–ด์ธ.์ปด)

        ๊ฐ€์ž… + ๋ฌด๋ฃŒ๋กœ ์ฝ”๋“œ ๋ฐ›์•„์„œ... 

        ๋ฉ”๋‰ด์–ผ ์ฐธ์กฐ.

        <script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script>

        

   2. ๊ตฌ๊ธ€ ์•„์ด์ฝ˜     

   <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">

   

   3. ๋ถ€ํŠธ ์ŠคํŠธ๋žฉ ์•„์ด์ฝ˜

   <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">

 

<!-- i[class]*5 -->
<i class="fas fa-cloud"></i>
<i class="fas fa-heart"  style="font-size: 36px; color:red"></i>
<i class="fas fa-car"></i>
<i class="fas fa-file"></i>
<i class="fas fa-bars"></i>

<i class="fas fa-clock"></i>
<i class="far fa-clock"></i>

<hr>
<i class="material-icons">cloud</i>
<i class="material-icons">favorite</i>
<i class="material-icons">attachment</i>
<i class="material-icons">computer</i>
<i class="material-icons">traffic</i>

<hr>
<span class="glyphicon glyphicon-cloud"></span>
<span class="glyphicon glyphicon-remove"></span>
<span class="glyphicon glyphicon-user"></span>
<span class="glyphicon glyphicon-envelope"></span>
<span class="glyphicon glyphicon-thumbs-up"></span>

css ๋งํฌ ํƒœ๊ทธ ๊พธ๋ฏธ๊ธฐ

<style>
   a:link, a:visited{
       border: 2px solid green;
       text-decoration: none;
       
       color:black;
       background-color: white;
       padding: 10px 20px; /*   t/b  l/r */
   }
   a:hover, a:active{
      background-color: red;
      color:white;
   }
</style>
<a href="#" target="_blank">This is a link</a>

 

<style>

 body{
    margin: 0;
    padding: 0;
 }
 
 .icon-bar{
   background-color: #555;
   width:90px;
   
   /* 
   position: relative;
   left:-80px;
    */
 }
 
 /* a ์ธ๋ผ์ธ๋ชจ๋“œ */
 .icon-bar a{
   display: block;   /*  width๋Š” ๋ถ€๋ชจ์˜ 100% */
   text-align: center;
   color:white;
   font-size: 36px;
   padding: 16px;
 }

.icon-bar a:hover{
  background-color: #000;
}

.icon-bar a.active{
  background-color: #4caf50;
}

</style>
<div class="icon-bar">
	<a href="#" class="active"><i class="fa fa-home"></i></a>
	<a href="#"><i class="fa fa-search"></i></a>
	<a href="#"><i class="fa fa-envelope"></i></a>
	<a href="#"><i class="fa fa-globe"></i></a>
	<a href="#"><i class="fa fa-trash"></i></a>
</div>

<style>
  body{
     margin: 0;
     padding: 0;
  }
  .topnav{
    background-color: #333;
    overflow: auto;  /* hidden */
  }
  .topnav a{
    color: #f2f2f2;
    text-decoration: none;
    
    padding: 14px 16px;
    text-align: center;
    
    float: left;
  }
  .topnav a:hover{
     color:black;
     background-color: #ddd;
  }
  
  .topnav a.active{
    background-color: #4caf50;
    color:white;
  }
  
</style>
<body>
<!-- ex14_03.html -->
<!-- .topnav>a[href=#]*4^div>h2#tne+p>lorem5 -->
<div class="topnav">
	<a href="#" class="active">Home</a>
	<a href="#">News</a>
	<a href="#">Contact</a>
	<a href="#">About</a>
</div>
<div>
	<h2 id="tne">Top Navigation Example</h2>
	<p onclick="p_click();">Lorem ipsum dolor sit amet.</p>
</div>

ํด๋ฆญ์ฒ˜๋ฆฌ

<script>
   // ํด๋ฆญ ์ด๋ฒคํŠธ ์ฒ˜๋ฆฌ 1 ๋ฒˆ์งธ ๋ฐฉ๋ฒ• :   <p   on์ด๋ฒคํŠธ๋ช…="js ํ•จ์ˆ˜ํ˜ธ์ถœ๋ถ€๋ถ„();">
   function p_click(){
	   alert("p_click~");
   }
   
   // ํด๋ฆญ ์ด๋ฒคํŠธ ์ฒ˜๋ฆฌ 2 ๋ฒˆ์งธ ๋ฐฉ๋ฒ• : 
   var h2element =  document.getElementById("tne");
   //   ์š”์†Œ.๋“ฑ๋กํ• ์ด๋ฒคํŠธ = ์ต๋ช… ํ•จ์ˆ˜ ์„ ์–ธ
   h2element.onclick = function (){
	   alert("h2_click~");
   }
</script>

ํด๋ฆญํ• ๋•Œ๋งˆ๋‹ค active ์†์„ฑ ์ถ”๊ฐ€ ๋ฐ ์ œ๊ฑฐ (js)

<script>
   // ๋ฉ”๋‰ด(a)๋ฅผ ํด๋ฆญํ•  ๋•Œ  News ๋ฉ”๋‰ด ํด๋ฆญ + .active ํด๋ž˜์Šค ์†์„ฑ์„ ์ถ”๊ฐ€
   //                              .active ํด๋ž˜์Šค ์†์„ฑ๋ฅผ ๊ฐ€์ง€๊ณ  ์žˆ๋˜ ๋ฉ”๋‰ด๋Š”  ํด๋ž˜์Šค ์†์„ฑ ์ œ๊ฑฐ
   
   // 1. ๋ชจ๋“  a ํƒœ๊ทธ๋ฅผ ๊ฐ€์ ธ์™€์„œ 
   /*
   var allA = document.getElementsByTagName("a");
   alert( allA.length );
   */
   
   // document.querySelector(selectors);  1๊ฐœ ์š”์†Œ ๋ฐ˜ํ™˜
   var alist = document.querySelectorAll("div.topnav a");  // NodeList 
   // alert( alist.length );
   
   // 2.  ํด๋ฆญ ์ด๋ฒคํŠธ ๋“ฑ๋ก...
   for (var i = 0; i < alist.length; i++) {
	 alist[i].onclick = function (){
		   // alert("ํด๋ฆญ~~~");
		   // 3.   class="active"  ์ œ๊ฑฐ,   ์ถ”๊ฐ€
		   
		   // ใ„ฑ.  active ํด๋ž˜์Šค ์†์„ฑ์„ ๊ฐ€์ง€๊ณ  ์žˆ๋˜ a ํƒœ๊ทธ๋Š” - > ์ œ๊ฑฐ 
		   //    ๋ณ€์ˆ˜ ์ €์žฅ X
		   for (var i = 0; i < alist.length; i++) {
			   alist[i].classList.remove("active");
		   }// for
		   
		   // ใ„ด. this : ํด๋ฆญ๋œ a ํƒœ๊ทธ  +  ํด๋ž˜์Šค ์†์„ฑ ์ถ”๊ฐ€./ ์ œ๊ฑฐ
		   this.classList.add("active");
	   } // 
  } // for
</script>
</body>

ํด๋ฆญํ• ๋•Œ๋งˆ๋‹ค active ์†์„ฑ ์ถ”๊ฐ€ ๋ฐ ์ œ๊ฑฐ (jquery)

<script>
   // jquery ๋‚ด์ผ ์ˆ˜์ •.
   // jquery selector
   // jquery method : removeClass(), addClass()
   // this -> $(this)  jquery object ๋งŒ๋“ค์–ด์•ผ์ง€
   $("div.topnav a").click(  function (){
	   $("div.topnav a").removeClass("active");
	   $(this).addClass("active");
   } );
</script>
  • ๋„ค์ด๋ฒ„ ๋ธ”๋Ÿฌ๊ทธ ๊ณต์œ ํ•˜๊ธฐ
  • ๋„ค์ด๋ฒ„ ๋ฐด๋“œ์— ๊ณต์œ ํ•˜๊ธฐ
  • ํŽ˜์ด์Šค๋ถ ๊ณต์œ ํ•˜๊ธฐ
  • ์นด์นด์˜ค์Šคํ† ๋ฆฌ ๊ณต์œ ํ•˜๊ธฐ