2021.07.13 CSS 실습(3)

hae.log·2021년 7월 13일

🚀html


<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="discription" content="우리쌀 점토로 만든 키즈가오 웹사이트 소개">
	<meta name="keywords" content="키즈가오, 점토, 장난감"> 
	<meta name="author" content="키즈가오">

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

	<title>키즈가오</title>

	<link rel="stylesheet" type="text/css" href="css/style.css">
	<link rel="stylesheet" type="text/css" href="css/animation.css">
	<link rel="stylesheet" type="text/css" href="css/mobile.css">
</head>   --------> 상단영역의 도면작업 끝


<body>


	<header id="intro">
		
		<div class="introWrap">
			<div class="logo"></div>
			<div class="lion"></div>
			<div class="rabbit"></div>
			<div class="bear"></div>
			<div class="monkey"></div>
		</div>

		<div class="cloudWrap">
			<div class="leftCloud"></div>
			<div class="rightCloud"></div>
			<div class="dragonfly"></div>
		</div>

	</header>


	<div id="farm1">

		<div class="leftRice1"></div>
		<div class="farmer"></div>
		<div class="rightRice1"></div>

		<div class="farmSpeechWrap">
			<img src="img/farm/farm1/farmspeech.png" align="우리쌀 점토">

			<p class="farmSpeech">
				식재료만 넣은 안전한<br>
				우리 쌀을 키즈가오는<br>
				우리 쌀을 사용하여 만들어요.<br>
				화학물질을 사용하지 않고,<br>
				식재료를 사용해서 만든<br>
				안전한 제품이랍니다.
			</p>
		</div>
		
	</div>


	💡 br태그를 넣어 줄바꿈 현상을 표현할수 있다.
	

	<div id="farm2">
		<div class="leftRice2"></div>
		<div class="scarecrow"></div>
		<div class="rightRice2"></div>
	</div>


	<div id="farm3">

		<div class="farm3Window"></div>	
		<div class="machineWrap">
			<div class="machine1"></div>
			<div class="sawshadow"></div>
			<div class="saw1"></div>
			<div class="saw2"></div>
			<div class="machineBird"></div>
			<div class="timer"></div>
		</div>

		<img class="farm3Bubble" src="img/farm/farm3/farm3bubble.png" alt="기계를 통해서 쌀알이 딱딱한 껍질을 벗어 냅니다.">

	</div>





</body>
</html>

🚀style.css

/* Default CSS*/
html, body {
	margin: 0;
	padding: 0;
}

body  {
	overflow-x: hidden;
}

👉 브라우저의 X축을 벗어나는 예를들어 브라우저의 크기보다
   더 외곽에 오브제가 있으면 Hidden 처리를 하겠다. 

💡 Hidden을 하지않으면 가로스크롤이 생기기때문

h1, h2, h3, h4, h5, h6, p {
	margin: 0;
	padding: 0;
}

button {
	border: none;
	background-color: transparent;
}

.clearfix {
	clear: both;
}

 📌floatleft floatright 속성값으로 좌우배치를 할때 
   clearboth속성값을 담고 있는 clear fix값을 넣어줘야함

/*Intro*/

#intro {
	widows: 100%;
	height: 1600px;
	background-image: url(../img/intro/intro_bg.png);

	/*padding-top:  100px*/
}

#intro .introWrap {
	position: relative;
    
	🚀 왜 position에 relative를 사용했는지 
           absolute를 사용했는지 position에 대한 이해도 필요!!
   

	width: 760px;
	height: 516px;
	/*background-color: yellow;*/

	left: 50%;
	margin-left: -380px;

	📒  left50%와 margin left -380으로 중앙정렬을 시켰는데 
            left50%를 사용할수 있는 이유
            
    ✔ 1. 3차원적인 특징을 갖고있는 
         fixed absolut relatvie(2,3 차원 모두해당) 만 가능하기 때문
      
    ✔ 2. intro wrap 영역은 position relative 로 감싸져 있고 logo, 
         동물들은 position absolute사용했고, monkey 부분에 
         margin으로 작업하면 top,left 따로 적용하면 
         좌표기준점이 달라지게 된다. 
         👉부모에게 position relative적용하기
    
	/*margin-top: 100px;*/

}
 👉 x 축 정렬 완성
#intro .introWrap .logo {
	position: absolute;
	
	width: 760px;
	height: 516px;
	background-image: url(../img/intro/logo.png);

	z-index: 100;
}
💡 로고를 밑으로 내리는 방법
           1. intro영역에 padding-top: 100px;로 intro 사이에 
              공백넣어주기
             👉 intro 부분에 100이라는 
                 공간의 크기가 들어가서 총 1600px이아닌 1700px로 이루		어져 다른 작업한 부분에 레이어까지 틀어질수 있음
     
	   2. top: 100px 사용
             👉 top: 100px 사용해서 내리면 두번째 레이어층 
                 cloudWrpa 위치는 고정이기때문에 cloudWrap 뒤로 들어가게된다. 
               ✍  position rekatuve 는 3차원적 요소에서 top을 사용하면 
                   자신이 직접주체가 되기때문에 이동하는데 아래쪽에 어떤레이아웃이 들어가 있더라도 변화가 없고, 
                   겹쳐 이동하기 때문에 레이아웃틀어짐 문제가 없다.


#intro .introWrap .lion {
	position: absolute;
    
    📌 로고기준으로 어떤동물은 앞에 어떤동물은 뒤에 
       즉 레이어층(=z축)이 존재하기때문에 
       어떤동물을 제일 위로 올릴것인지 고려해양함
       -> 3차원적인 포지션 속성값에 사용가능하다는 이야기
          = absolute사용 해야함

	width: 161px;
	height: 161px;
	background-image: url(../img/intro/lion.png);

	margin: 80px 0 0 30px;
    }
    
   ✍  z-index를 사용하지 않았지만 0인상태다 라고 생각했을때, 
       0 > 100 이기 때문에 사자는 logo 뒤에 배치된다.
		

#intro .introWrap .rabbit {
	position: absolute;

	width: 105px;
	height: 129px;
	background-image: url(../img/intro/rabbit.png);

	margin: 90px  0 0 580px;
}

#intro .introWrap .bear {
	position: absolute;

	width: 112px;
	height: 105px;
	background-image: url(../img/intro/bear.png);

	margin: 310px 0 0 560px;

	z-index: 200;
}

#intro .introWrap .monkey {
	position: absolute;

	width: 85px;
	height: 93px;
	background-image: url(../img/intro/monkey.png);

	margin: 310px 0 0 50px;

	z-index: 200;
}


--------상단영역 배치작업, 이미지삽입작업완료--------

📌cloud wrap 배치작업

✔ 이미지 작업할때, background image는 repect 효과가 들어가 있어 
   background-repeat: none-repeat; 넣어주어 하나의 그림만 나오도록 해야함

#intro .cloudWrap {
	position: relative;

	width: 100%;
	height: 1050px;
	/*background-color: pink;*/
}

#intro .cloudWrap .leftCloud {
	position: absolute;

	width: 934px;
	height: 816px;
	background-image: url(../img/intro/cloud1.png);
	
}

#intro .cloudWrap .rightCloud {
	position: absolute;

	width: 843px;
	height: 858px;
	background-image: url(../img/intro/cloud2.png);

	right: 0;
}

#intro .cloudWrap .dragonfly {
	position: absolute;

	width: 366px;
	height: 228px;
	background-image: url(../img/intro/dragonfly.png);
	top: 800px;
}


/*Farm1*/

#farm1 {
	position: relative;

	width: 100%;
	height: 800px;
	background-image: url(../img/farm/farm1/farm1.bg.png);
}

#farm1 .leftRice1 {
	position: absolute;

	width: 390px;
	height: 670px;
	background-image: url(../img/farm/farm1/leftrice.png);

	left: 0;
}

#farm1 .rightRice1 {
	position: absolute;

	width: 355px;
	height: 570px;
	background-image: url(../img/farm/farm1/rightrice.png);

	right: 0;
	top: 100px;
}

#farm1 .farmer {
	position: absolute;

	width: 747px;
	height: 1078px;
	background-image: url(../img/farm/farm1/farmer.png);

	left: 50%;
	margin-left: -310px;
}

#farm1 .farmSpeechWrap {
	position: relative;

	top: 250px;
	left: 150px;
}

#farm1 .farmSpeechWrap .farmSpeech {
	color: #895c2F;
	font-size: 18px;
	line-height: 27px;
}



/*Farm2*/

#farm2 {
	position: relative;
	width: 100%;
	height: 850px;
	background-image: url(../img/farm/farm2/farm2_bg.png);
}

#farm2 .leftRice2 {

	float: left;

	width: 250px;
	height: 850px;
	background-image: url(../img/farm/farm2/leftRice2.png);
}

#farm2 .rightRice2 {

	float: right;

	width: 236px;
	height: 850px;
	background-image: url(../img/farm/farm2/rightrice2.png);
}

#farm2 .scarecrow {
	position: absolute;

	width: 103px;
	height: 206px;
	background-image: url(../img/farm/farm2/scarecrow.png);

	margin: 200px 0 0 300px;
}


/*Farm3*/

#farm3 {
	position: relative;

	width: 100%;
	height: 850px;
	background-image: url(../img/farm/farm3/farm3_bg.png);
}

#farm3 .farm3Window {
	position: absolute;

	width: 247px;
	height: 169px;
	background-image: url(../img/farm/farm3/window.png);

	margin: 100px 0 0 100px;
}

#farm3 .machineWrap {
	position: relative;

	width: 600px;
	height: 455px;
	

	left: 50%;
	margin-left: -285px;
	top: 150px;

}

#farm3 .machineWrap .machine1 {
	position: absolute;
	width: 586px;
	height: 455px;
	background-image: url(../img/farm/farm3/machine1.png);

	z-index: 900;
}

#farm3 .machineWrap .sawshadow {
	position: absolute;

	width: 95px;
	height: 95px;
	background-image: url(../img/farm/farm3/sawshadow.png);

	margin: 145px 0 0 145px;
}

#farm3 .machineWrap .saw1,
#farm3 .machineWrap .saw2 {
	position: absolute;
	width: 95px;
	height: 95px;
	background-image: url(../img/farm/farm3/saw.png);
}

#farm3 .machineWrap .saw1 {
	margin: 140px 0 0 140px;
}

#farm3 .machineWrap .saw2 {
	margin: 140px 0 0 350px;
}
 
#farm3 .machineWrap .timer {
	position: absolute;
	width: 103px;
	height: 104px;
	background-image: url(../img/farm/farm3/second.png);

	margin: 125px 0 0 45px;

	z-index: 999;
}

#farm3 .machineWrap .machineBird {
	position: absolute;

	width: 44px;
	height: 49px;
	background-image: url(../img/farm/farm3/machinebird.png);

	margin: 220px 0 0 20px;

	z-index: 999;
}

#farm3 .farm3Bubble {
	position: absolute;

	top: 350px;
	right: 80px;
}

animation


/*Intro*/

#intro .introWrap .lion {
	animation: spinLion 1500ms linear infinite alternate;
}
@keyframes spinLion {
	from {
		transform: rotate(-10deg);
	}

	to {
		transform: rotate(10deg);
	}
}

#intro .introWrap .rabbit {
	animation: spinRabbit 1000ms linear infinite alternate;
}
@keyframes spinRabbit {
	from {
		transform: rotate(0deg);
	}

	to {
		transform: rotate(5deg);
	}
}

#intro .introWrap .bear {
	animation: spinBear 1000ms linear infinite alternate;
}
@keyframes spinBear {
	from {
		transform: rotate(10deg);
	}

	to {
		transform: rotate(-10deg);
	}
}

#intro .introWrap .monkey {
	animation: spinMonkey 800ms linear infinite alternate;
}
@keyframes spinMonkey {
	from {
		transform: rotate(20deg);
	}

	to {
		transform: rotate(50deg);
	}
}

#intro .cloudWrap .dragonfly {
	animation: flyDragonfly linear 7s infinite;
}

@keyframes flyDragonfly {
	from {
		left: -366px;
	}

	to {
		left: 100%;
	}
}


#farm3 .machineWrap .timer {
	animation: rotateTimer 10000ms linear infinite;
}

@keyframes rotateTimer {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}


#farm3 .machineWrap .saw1 {
	animation: rotateLeftSaw 10000ms linear infinite;
}

@keyframes rotateLeftSaw {
	from { transform: rotate(0deg); }
	to { transform: rotate(360deg); }
}

#farm3 .machineWrap .saw2 {
	animation: rotateRightSaw 10000ms linear infinite;
}

@keyframes rotateRightSaw {
	from { transform: rotate(360deg); }
	to { transform: rotate(0deg); }
}

🚀mobile.css

@media (max-width: 767px) {

#intro {
	height: 1150px;
	background-image: url(../img/mobile/intro/mobile_intro_bg.png);
}

#intro .introWrap {
	width: 189px;
	height: 129px;

	margin-left: -94.5px;
	/*background-color: yellow;*/

	top: 230px;

}

#intro .introWrap .logo {
	width: 189px;
	height: 129px;
	background-image: url(../img/mobile/intro/mobile_logo.png);
}

#intro .introWrap .lion,
#intro .introWrap .rabbit,
#intro .introWrap .bear,
#intro .introWrap .monkey,
#intro .cloudWrap .dragonfly {
	/*노출을 결정짓는 기능도 같이 갖고있다.*/
	display: none;
}

#intro .cloudWrap {
	height: 350px;

	top: 280px;

}

#intro .cloudWrap .leftCloud {
	width: 267px;
	height: 314px;
	background-image: url(../img/mobile/intro/mobile_cloud1.png);
}

#intro .cloudWrap .rightCloud {
	width: 237px;
	height: 309px;
	background-image: url(../img/mobile/intro/mobile_cloud2.png);
}

}

/*Farm1*/

#farm1 {
	height: 450px;
	background-image: url(../img/mobile/farm/farm1/mobile_farm1_bg.png);
}

#farm1 .leftRice1 {
	width: 86px;
	height: 150px;
	background-image: url(../img/mobile/far/farm1/mobile_leftrice.png);
}


#farm1 .rightRice1 {
	width: 95px;
	height: 170px;
	background-image: url(../img/mobile/far/farm1/mobile_rightrice.png);

	top: -20px;
}

#farm1 .farmer {
	width: 160px;
	height: 250px;
	background-image: url(../img/mobile/farm/farm1/mobile_farmer.png);

	margin-left: -69px;
}


#farm1 .farmSpeechWrap {
	width: 300px;

	text-align: center;

	left: 50%;
	margin-left: -150px;
}

#farm1 .farmSpeechWrap img {
	width: 79px;
}

#farm1.farmSpeechWrap .farmSpeech {
	line-height: 20px;
	font-size: 12px;
}

#farm2 {
	height: 440px;
	background-image: url(../img/mobile/farm/farm2/mobile_farm2_bg.png);
}

#farm2 .leftRice2 {
	width: 57px;
	height: 201px;
	background-image: url(../img/mobile/farm/farm2/mobile_leftrice2.png);
}

#farm2 .rightRice2 {
	width: 54px;
	height: 202px;
	background-image: url(../img/mobile/farm/farm2/mobile_rightrice.png);
}

#farm2 .scarecrow {
	display: none;
}



#farm3 {
	height: 500px;
	background-image: url(../img/mobile/farm/farm3/mobile_farm3_bg.png);
}

#farm3 .farm3Window {
	width: 82px;
	height: 56px;
	background-image: url(../img/mobile/farm/farm3/mobile_window.png);

	margin: 10px 0 0 10px;
}

#farm3 .machineWrap {
	width: 200px;
	height: 150px;

	top: 120px;
	margin-left: -96px;
}

#farm3 .machineWrap .machine1 {
	width: 191px;
	height: 149px;
	background-image: url(../img/mobile/farm/farm3/mobile_machine1.png);
}

#farm3 .machineWrap .sawShadow,
#farm3 .machineWrap .timer,
#farm3 .machineWrap .machineBird {
	display: none;
}

#farm3 .machineWrap .saw1,
#farm3 .machineWrap .saw2 {
	width: 31px;
	height: 31px;
	background-image: url(../img/mobile/farm/farm3/mobile_saw.png);
}

#farm3 .machineWrap .saw1 {
	margin: 50px 0 0 50px;
}

#farm3 .machineWrap .saw2 {
	margin: 50px 0 0 115px;
}


#farm3 .farm3Bubble { 
	position: absolute;

	width: 152px;

	left: 50%;
	margin: 0 0 0 -70%;
}

📒 직접디자인 작업을 해야하면 크기의 끝자리가 5 또는 짝수가 아닌 이미지의 크기는 사용하지 않음 why? 정확한 레이아웃 배치작업이 안될수 있기때문

0개의 댓글