day5

์ƒ์€๐Ÿ‘ธยท2023๋…„ 10์›” 12์ผ
0

๋šœ๋ฒ…๋šœ๋ฒ… ๋‘๋ฒˆ์งธ

๋ชฉ๋ก ๋ณด๊ธฐ
9/13
post-thumbnail
post-custom-banner

1์ฐจํ‰๊ฐ€ ํœด,,,,, 1์ฐจํ”„๋กœ์ ํŠธ ํ• ๋•Œ๊ฐ€ ๋๋‹ค ํœด,,,,,,

๐Ÿ“– page : ํ™”๋ฉด์ด๋™

=> ๋„ค์ด๋ฒ„์›นํˆฐ ๋“ค์–ด๊ฐ€์„œ ์›”์š”์ผ์›นํˆฐ ํ™”์š”์ผ์›นํˆฐ.. ๋ฒ„ํŠผ๋ˆ„๋ฅด๋ฉด ์›”์š”์ผ์›นํˆฐ๋“ค์–ด๊ฐ€๊ณ  ํ™”์š”์ผ์›นํˆฐ๋“ค์–ด๊ฐ€๊ณ  ๊ทธ ํ•ด๋‹น ์š”์ผ๋ฒ„ํŠผ ์ƒ‰์ƒ๋งŒ ๋ฐ”๊ปด์žˆ๋Š” ๋ชจ์Šต์„ ๋ณผ ์ˆ˜์žˆ๋‹ค! ์ด๋Ÿฐ๊ฑธ ๋งŒ๋“ค์–ด๋ณด์ž๋ฉด

๊ณตํ†ต์˜ ์„ฑ์งˆ์„ ์™ธ๋ถ€์Šคํƒ€์ผ css ํŒŒ์ผ๋กœ ๋งŒ๋“ค์–ด๋†“๊ณ 

page1, page2, page3 head ๋ถ€๋ถ„์—

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

์„ ๊ฑธ์–ด๋†“๊ณ  ์‚ฌ์šฉํ•œ๋‹ค!

โœŒ page1

<head>
	<link href="./page_nav.css" rel="stylesheet"> <!--*์™ธ๋ถ€ ์Šคํƒ€์ผ*-->
</head>

<body>
  <h1>์—ฌ๊ธฐ๋Š” page 1 ํ™”๋ฉด 1111</h1>

      <div class="nav">
          <a href="./page1.html"><div class="menu-btn-div menu-btn-div-active">page1  
          </div></a><a href="./page2.html"><div class="menu-btn-div">page2
          </div></a><a href="./page3.html"><div class="menu-btn-div">page3</div></a>
      </div>

</body>

โœŒ page2

<head>
	<link href="./page_nav.css" rel="stylesheet"> <!--*์™ธ๋ถ€ ์Šคํƒ€์ผ*-->
</head>

<body>
  <h1>์—ฌ๊ธฐ๋Š” page 2ํ™”๋ฉด 2222</h1>

      <div class="nav">
          <a href="./page1.html"><div class="menu-btn-div menu-btn-div-active">page1  
          </div></a><a href="./page2.html"><div class="menu-btn-div">page2
          </div></a><a href="./page3.html"><div class="menu-btn-div">page3</div></a>
      </div>

</body>

โœŒ page3

<head>
	<link href="./page_nav.css" rel="stylesheet"> <!--*์™ธ๋ถ€ ์Šคํƒ€์ผ*-->
</head>

<body>
  <h1>์—ฌ๊ธฐ๋Š” page 3 ํ™”๋ฉด 3333</h1>

      <div class="nav">
          <a href="./page1.html"><div class="menu-btn-div menu-btn-div-active">page1  
          </div></a><a href="./page2.html"><div class="menu-btn-div">page2
          </div></a><a href="./page3.html"><div class="menu-btn-div">page3</div></a>
      </div>

</body>

๐Ÿ– page_nav.css

* {
    box-sizing: border-box; //page1,2,3์ด ๋“ค์–ด๊ฐ€๊ฒŒ ํ•˜๊ธฐ์œ„ํ•ด!
    margin: 0;
    padding: 0;
}

.nav { //ํฐ๋ฐ•์Šค ์•ˆ์— page1,2,3์ด ๋“ค์–ด๊ฐ€๊ฒŒ
    width: 450px;
    height: 100px;
}

.menu-btn-div {
    width: 150px;
    height: 100px;
    border: 1px solid black;
    display: inline-block; //inline์ธ๋ฐ blockํŠน์ง•์ธ width,height,margin์ด ์ ์šฉ๋˜๋Š”!
    padding-top: 35px;
    padding-left: 50px;
}

.menu-btn-div-active { /*page2์—์„œ๋Š” page2๋ฒ„ํŠผ์ด ํ™œ์„ฑํ™” ๋˜๊ฒ ์ง€*/ //๊ฐ๊ฐ page1,2,3 ๋“ค์–ด๊ฐˆ๋•Œ๋งˆ๋‹ค ํ™œ์„ฑํ™” ๋˜์•ผํ•˜๋Š”
    color: white;
    background-color: #cef29e;
}

๐Ÿ“– ์ •๋ ฌ

๐Ÿ‘Œ๊ฐ€์šด๋ฐ ์ •๋ ฌ

  1. ๋‚ด ์š”์†Œ ์ •๋ ฌ = magin:0 auto; (top,bottom=0 , left,right=auto)
    // ํ•ด๋‹น๋ฐ•์Šค {magin:0 auto;}

  2. ๋‚ด๋ถ€ ์š”์†Œ ์ •๋ ฌ = text-align:center;
    // ํ…์ŠคํŠธ๊ฐ€ ์žˆ๋Š” ํ•ด๋‹น๋ฐ•์Šค {text-align:center;}

<style>
  .dept1 {
      width: 400px;
      height: 400px;
      background-color: gray;
      margin:0 auto;
      text-align: center;
  }

  .dept2 {
       width: 200px;
       height: 200px;
       background-color: red;
       margin:0 auto;
  }
</style>
<div class="dept1">
	<span>dept1 ๋‚ด๋ถ€ ํ…์ŠคํŠธ</span>
    <div class="dept2"></div>
</div>

=> ๐Ÿ’ป

๐Ÿ“– background

1. ๋ฐฐ๊ฒฝ์ƒ‰์ƒ = background-color:

์—ฌ๋Ÿฌ๊ฐ€์ง€์ƒ‰;
transparent; (ํˆฌ๋ช…ํ•œ)

2. ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง€ = background-image: url("๊ฒฝ๋กœ");

3. ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง€ ์‚ฌ์ด์ฆˆ ์กฐ์ ˆ = background-size:

auto; (์›๋ž˜ํฌ๊ธฐ) -> ๊ธฐ๋ณธ๊ฐ’
๐Ÿ‘‰@ cover; (ํ™”๋ฉด์š”์†Œ ์‚ฌ์ด์ฆˆ->๋‚ด๊ฐ€ ์ง€์ •ํ•œ ์‚ฌ์ด์ฆˆ ์— ๋งž๊ฒŒ ํ™”๋ฉด ๊ฝ‰ ์ฑ„์›€)
=> ๐Ÿ’ป

contain; (ํ™”๋ฉด์š”์†Œ ์‚ฌ์ด์ฆˆ->๋‚ด๊ฐ€ ์ง€์ •ํ•œ ์‚ฌ์ด์ฆˆ ์•ˆ์— ์ด๋ฏธ์ง€๊ฐ€ ์ž˜ ๋“ค์–ด๊ฐ€๋„๋ก ์กฐ์ •)

=> ๐Ÿ’ป

width height; (์‚ฌ์ด์ฆˆ ์ž์ฒด ์ง€์ •)

4. ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง€ ๋ฐ˜๋ณต = background-repeat:

repeat; (๋ฐ˜๋ณต) -> ๊ธฐ๋ณธ๊ฐ’
๐Ÿ‘‰@ no-repeat; (๋ฐ˜๋ณตX)
repeat-x; x์ถ•(๊ฐ€๋กœ) ๋กœ๋งŒ ๋ฐ˜๋ณต
repeat-y; y์ถ•(์„ธ๋กœ) ๋กœ๋งŒ ๋ฐ˜๋ณต
round; ์‚ฌ์ด์ฆˆ์— ๋งž๊ฒŒ ์กฐ์ ˆํ•ด์„œ ๋ฐ˜๋ณต
space; ์ž˜๋ฆฌ์ง€ ์•Š์„ ๊ณต๊ฐ„์ด ์žˆ์–ด์•ผ ๋ฐ˜๋ณต

5. ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง€ ์œ„์น˜ = background-position: x์ถ•(๊ฐ€๋กœ)์œ„์น˜ y์ถ•(์„ธ๋กœ)์œ„์น˜

6. ๋ฐฐ๊ฒฝ์ด๋ฏธ์ง€ ์Šคํฌ๋กค์‹œ ์ด๋™๋ฐฉ๋ฒ• = background-attachment:

์Šคํฌ๋กค ๊ธฐ์ค€ (ex ํšŒ์›๊ฐ€์ž…์•ฝ๊ด€)
1) ๋‚ด ์š”์†Œ ์ž์ฒด์˜ ์Šคํฌ๋กค (ex ์ด์šฉ์•ฝ๊ด€ ์Šคํฌ๋กค)
2) ๋ธŒ๋ผ์šฐ์ € ์Šคํฌ๋กค (ex ์›นํŽ˜์ด์ง€ ์ž์ฒด ์Šคํฌ๋กค)

local : ์š”์†Œ์Šคํฌ๋กคO, ๋ธŒ๋ผ์šฐ์ €์Šคํฌ๋กคX // ์š”์†Œ๋ฐฐ๊ฒฝ ์›€์ง์—ฌ, ๋ธŒ๋ผ์šฐ์ €๋ฐฐ๊ฒฝ ์•ˆ์›€์ง์—ฌ
scroll : ์š”์†Œ์Šคํฌ๋กคX, ๋ธŒ๋ผ์šฐ์ €์Šคํฌ๋กคX // ์š”์†Œ๋ฐฐ๊ฒฝ ์•ˆ์›€์ง์—ฌ, ๋ธŒ๋ผ์šฐ์ €๋ฐฐ๊ฒฝ ์•ˆ์›€์ง์—ฌ
๐Ÿ‘‰@fixed : ์š”์†Œ์Šคํฌ๋กคX, ๋ธŒ๋ผ์šฐ์ €์Šคํฌ๋กคO // ์š”์†Œ๋ฐฐ๊ฒฝ ์•ˆ์›€์ง์—ฌ, ๋ธŒ๋ผ์šฐ์ €๋ฐฐ๊ฒฝ ์›€์ง์—ฌ

profile
๋’ค์ฃฝ๋ฐ•์ฃฝ ๋ฒจ๋กœ๊ทธ
post-custom-banner

0๊ฐœ์˜ ๋Œ“๊ธ€