[Day4] CSS 4 [11/15]

 

[overflow]

1. ์š”์†Œ์˜ ์ฝ˜ํ…์ธ (๋‚ด์šฉ)๊ฐ€ ๋„ˆ๋ฌด ์ปค์„œ ์ง€์ •๋œ ์˜์—ญ์— ๋งž์ง€ ์•Š์„ ๋•Œ ์ฝ˜ํ…์ธ (๋‚ด์šฉ)์„ ์ž๋ฅผ์ง€ ๋˜๋Š” ์Šคํฌ๋กค๋ฐ”๋ฅผ ์ถ”๊ฐ€ํ• ์ง€ ์—ฌ๋ถ€๋ฅผ ๊ฒฐ์ •ํ•˜๋Š” ์†์„ฑ

2. li, a ์ธ๋ผ์ธ๋ชจ๋“œ ๋ฉ”๋‰ด : float:left overflow:auto+๋‹ค์Œ์š”์†Œ..

 

- auto : ์ž๋™. ์ฝ˜ํ…์ธ ๊ฐ€ ๋„˜์น˜๋Š” ๊ฒฝ์šฐ์—๋งŒ ์Šคํฌ๋กค๋ฐ” ์ถ”๊ฐ€.

- visible(๊ธฐ๋ณธ๊ฐ’) : ์˜์—ญ ์™ธ๋ถ€์— ๋„˜์น˜๋Š” ์ฝ˜ํ…์ธ ๊ฐ€ ์ถœ๋ ฅ(๋žœ๋”๋ง) ๋˜์–ด์ง„๋‹ค.

- hidden : ์ฝ˜ํ…์ธ ๊ฐ€ ๋„˜์น˜๋Š” ๋ถ€๋ถ„์€ ์ž˜๋ผ๋ฒ„๋ฆฐ๋‹ค. ๋ณด์ด์ง€ ์•Š๋„๋ก ํ•œ๋‹ค.

- scroll : ์ฝ˜ํ…์ธ ๊ฐ€ ๋„˜์น˜๋Š” ์ง€์— ๋Œ€ํ•œ ์—ฌ๋ถ€์™€ ์ƒ๊ด€์—†์ด ๋ฌด์กฐ๊ฑด ์Šคํฌ๋กค๋ฐ” ์ถ”๊ฐ€.

 

div{
	/* block๋ชจ๋“œ */
	/* ๋†’์ด ์ง€์ • */
	background-color: coral;	/* ์‚ฐํ˜ธ์ƒ‰ */
	border:1px solid;
	width:300px;
	
	height:600px;
	/* height:65px; */
	
	/* overflow:visible; */
	/* overflow:hidden;  */
	/* overflow:scroll; */
	/* overflow-x:scroll; */
	/* overflow-y:scroll; */
	overflow:auto;
}

 

(์ฐธ๊ณ ์‚ฌํ•ญ) overflow ์†์„ฑ์€ [๋†’์ด๊ฐ€ ์„ค์ •๋œ] [block ๋ชจ๋“œ]์—์„œ๋งŒ ์ ์šฉ๋œ๋‹ค.


[float]

1. ์‚ฌ์ „์ ์˜๋ฏธ : ๋‘ฅ๋‘ฅ ๋– ๋‹ค๋‹ˆ๋‹ค.

2. ์š”์†Œ๊ฐ€ ๋– ๋‹ค๋‹ˆ๋Š” ๋ฐฉ๋ฒ•์„ ์ง€์ •ํ•˜๋Š” ์†์„ฑ

3. ์ฝ˜ํ…์ธ ๋ฅผ ๋ฐฐ์น˜ํ•˜๊ณ  ํ˜•์‹์„ ์ง€์ •ํ•˜๋Š”๋ฐ ์‚ฌ์šฉ

4. ์ด๋ฏธ์ง€ ์ปจํ…Œ์ด๋„ˆ์˜ ํ…์ŠคํŠธ ์™ผ์ชฝ, ์˜ค๋ฅธ์ชฝ ๋ฐฐ์น˜( ๋–  ์žˆ๊ฒŒ ํ•œ๋‹ค. )

5. ์†์„ฑ๊ฐ’ : left, right, none(๊ธฐ๋ณธ๊ฐ’), inherit - (๋ถ€๋ชจ์š”์†Œ์˜ float ๊ฐ’์„ ์ƒ์†)

 

<style>
p{
	border:3px solid #4caf50;
	padding:5px;
	
	/* overflow:auto; */ /* 1๋ฒˆ. */
}

/*
.clearfix{
	overflow:auoto;
}
*/

/* :์˜์‚ฌํด๋ž˜์Šค */
/* ::์˜์‚ฌ์š”์†Œ */
/* p::after{ */
.clearfix::after{
	content:"";
	clear:both;
	display:table;
}

p img{
	width:170px;
	float:left;
}
</style>
<p class="clearfix">
	<img src="../images/pineapple.jpg" alt="ํŒŒ์ธ์• ํ”Œ">
	Lorem ipsum dolor sit amet, consectetur adipisicing elit. 
	Ut ipsum ipsam quae veritatis assumenda cumque dicta 
	libero minus laboriosam in quaerat neque inventore a 
	ducimus doloribus magni fuga eos qui.
</p>

 

<style>
.clearfix div{
	padding:15px;
	border:1px solid;
	float:left;
}
</style>
<div class="clearfix">
	<div class="box1">box1</div>
	<div class="box2">box2</div>
	<div class="box3" style="float:right">box3</div>
</div>

* ์˜์‚ฌํด๋ž˜์Šค ์˜์‚ฌ์š”์†Œ : https://velog.io/@chyori/CSS-%EC%9D%98%EC%82%AC-%ED%81%B4%EB%9E%98%EC%8A%A4

 

[clear] : https://ofcourse.kr/css-course/clear-%EC%86%8D%EC%84%B1

1. float ์š”์†Œ ์˜†์— ์žˆ๋Š” ์š”์†Œ์— ์–ด๋–ค ์ผ์ด ๋ฐœ์ƒํ•ด์•ผ ํ•˜๋Š”์ง€๋ฅผ ์ง€์ •ํ•˜๋Š” ์†์„ฑ.

2. none(๊ธฐ๋ณธ๊ฐ’)

3. left : ์™ผ์ชฝ float์š”์†Œ์˜ ์•„๋ž˜๋กœ ์ถœ๋ ฅ

4. right : ์˜ค๋ฅธ์ชฝ float์š”์†Œ์˜ ์•„๋ž˜๋กœ ์ถœ๋ ฅ

5. both : ์™ผ์ชฝ + ์˜ค๋ฅธ์ชฝ float ์š”์†Œ์˜ ์•„๋ž˜๋กœ ์ถœ๋ ฅ

6. inherit : ์ƒ์†


ํŒ์—…(popup) ํผ(form)

<style>

body{
	font-family:Arial, Verdana, sans-serif;
}

*{
	box-sizing:border-box;
}

.open-button{
	background-color: #555;
	color:white;
	padding:16px 20px;
	border:none;
	cursor:pointer;
	opacity:0.8;
	position:fixed;
	right:28px;
	bottom:23px;
	width:280px;
}

.form-popup{
	display:none;
	
	border:3px solid #f1f1f1;
	
	position:fixed;
	bottom:0;
	right:15px;
	z-index:9;
}

.form-container{
	max-width:300px;
	padding:10px;
	background-color: white;
}

.form-container input[type=text], .form-container input[type=password]{
	width:100%;
	margin:5px 0 22px 0;
	border:none;
	background-color: #f1f1f1;
	padding:15px;
}
.form-container input[type=text]:focus
, .form-container input[type=password]:focus{
	background-color: #ddd;
	outline:none; /* border ๋ฐ– */
	
}

.form-container .btn{
	background-color: #4caf50;
	color:white;
	padding:16px 20px;
	border:none;
	cursor:pointer;
	width:100%;
	margin-bottom:10px;
	opacity:0.8;
}

.form-container .btn:hover, open-button:hover{
	opacity:1;
}
.form-container .cancel{
	background-color: red;
}

</style>
<div class="form-popup" id="myForm">
  <form action="" class="form-container">
    <h1>Login</h1>

    <label for="email"><b>Email</b></label>
    <input type="text" placeholder="Enter Email" name="email" required>

    <label for="psw"><b>Password</b></label>
    <input type="password" placeholder="Enter Password" name="psw" required>

    <button type="submit" class="btn">Login</button>
    <button type="button" class="btn cancel">Close</button>
  </form>
</div>

* outline : border ๋ฐ”๊นฅ

1) Open Form์„ ํด๋ฆญํ•˜๋ฉด ์ˆจ๊ฒจ์ง„ form-popup div ๋ณด์ด๋„๋ก js & jquery ์ฝ”๋”ฉ.

	document.querySelector("button.open-button").onclick=function(){
		// alert("!!");
		// document.getElementById("myForm").setAttribute(); /getAttribute();
		document.querySelector("#myForm").style.display="block";
		document.querySelector("#myForm input[name=email]").focus();
	}
	$("button.open-button").click( function (){
		// alert("!!");
		$("#myForm").show();
		$("#myForm input[name=email]").focus();
	});

2) ๋‹ซ๊ธฐ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด ๋ณด์—ฌ์ง„ form-popup div ์ˆจ๊ธฐ๋„๋ก js &  jquery ์ฝ”๋”ฉ.

		document.querySelector("button.btn.cancel").onclick=function(){
		// alert("!!");
		// document.getElementById("myForm").setAttribute(); /getAttribute();
		document.querySelector("#myForm").style.display="none";
		
		document.querySelector("#myForm input[name=email]").value="";
		document.querySelector("#myForm input[name=psw]").value="";
	$("button.btn.cancel").click(function(){
		// alert("!!");
		$("#myForm").hide();
		$("#myForm input[name=email]").val("");
		$("#myForm input[name=psw]").val("");
	});

๋ฐ˜์‘ํ˜•(Responsive) ํผ(Form)

<style>

*{
	box-sizing:border-box;
}

input[type=text], select, textarea{
	width:100%;
	padding:12px;
	border:1px solid #ccc;
	border-radius: 4px;
}

.row label{
	display:inline-block;
	padding:12px 12px 12px 0;
}

input[type=submit]{
	background-color: #4caf50;
	color:white;
	padding:12px 20px;
	border:none;
	border-radius:4px;
	cursor:pointer;
	
	float:right;
}

input[type=submit]:hover{
	background-color: #45a049;
}

.container{
	border-radius:5px;
	background-color: #f2f2f2;
	padding:20px;
}

.col-25{
	float:left;
	width:25%;
	margin-top:6px;
}

.col-75{
	float:left;
	width:75%;
	margin-top:6px;
}

.row::after{
	content:"";
	clear:both;
	display:table;
}

</style>

<style>
/* ๋ฏธ๋””์–ด์ฟผ๋ฆฌ + ์กฐ๊ฑด */
@media only screen and (max-width:600px){
	.col-25, .col-75, input[type=submit]{
		width:100%;
		margin-top:0;
	}
}
</style>

* row ๋กœ ๊ตฌ๋ถ„ ์ œ๋Œ€๋กœ ํ•ด์ฃผ๊ธฐ์œ„ํ•ด .row::after ์ถ”๊ฐ€

<div class="container">
  <form action="">
    <div class="row">
      <div class="col-25">
        <label for="fname">First Name</label>
      </div>
      <div class="col-75">
        <input type="text" id="fname" name="firstname" placeholder="Your name..">
      </div>
    </div>
    <div class="row">
      <div class="col-25">
        <label for="lname">Last Name</label>
      </div>
      <div class="col-75">
        <input type="text" id="lname" name="lastname" placeholder="Your last name..">
      </div>
    </div>
    <div class="row">
      <div class="col-25">
        <label for="country">Country</label>
      </div>
      <div class="col-75">
        <select id="country" name="country">
          <option value="australia">Australia</option>
          <option value="canada">Canada</option>
          <option value="usa">USA</option>
        </select>
      </div>
    </div>
    <div class="row">
      <div class="col-25">
        <label for="subject">Subject</label>
      </div>
      <div class="col-75">
        <textarea id="subject" name="subject" placeholder="Write something.." style="height:200px"></textarea>
      </div>
    </div>
    <div class="row">
      <input type="submit" value="Submit">
    </div>
  </form>
</div>

[display ์†์„ฑ]

1. inline ๋ชจ๋“œ

    ๋„ˆ๋น„์™€ ๋†’์ด ์„ค์ •์€ ๋ถˆ๊ฐ€๋Šฅํ•˜๋‹ค.

2. block ๋ชจ๋“œ

    ๋„ˆ๋น„์™€ ๋†’์ด ์„ค์ •์ด ๊ฐ€๋Šฅํ•˜๋‹ค.

     but ๋ฌธ์ œ์ ) ์ž๋™ ๊ฐœํ–‰..

3.inline-block ๋ชจ๋“œ

    ๋„ˆ๋น„์™€ ๋†’์ด ์„ค์ •์ด ๊ฐ€๋Šฅํ•˜๋‹ค. ์ž๋™ ๊ฐœํ–‰ X.

    top, bottom ์—ฌ๋ฐฑ/ํŒจ๋”ฉ ์ ์šฉ๋„ ๊ฐ€๋Šฅํ•˜๋‹ค.  

 

<style>

span.a{
	/* inline */
	display:inline; /* span ์š”์†Œ์˜ ๊ธฐ๋ณธ๊ฐ’ */
	border:1px solid blue;
	background-color: yellow;
	padding:5px;	/* ์ ์šฉ๋จ. */
	
	/* ๋„ˆ๋น„, ๋†’์ด */
	width:150px;
	height:100px;
}
span.b{
	/* block */
	display:block; /* span ์š”์†Œ์˜ ๊ธฐ๋ณธ๊ฐ’ */
	border:1px solid blue;
	background-color: yellow;
	padding:5px;	/* ์ ์šฉ๋จ. */
	
	/* ๋„ˆ๋น„, ๋†’์ด */
	width:150px;
	height:100px;
}
span.c{
	/* inline-block */
	display:inline-block; /* span ์š”์†Œ์˜ ๊ธฐ๋ณธ๊ฐ’ */
	border:1px solid blue;
	background-color: yellow;
	padding:5px;	/* ์ ์šฉ๋จ. */
	
	/* ๋„ˆ๋น„, ๋†’์ด */
	width:150px;
	height:100px;
}

</style>
<h3>display:inline</h3>
<div>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. 
Rem ipsam dicta nam <span class="a">aliquam</span> 
<span class="a">eum</span> distinctio expedita delectus 
repellendus veniam dolor fugiat suscipit quas nihil libero 
architecto iusto odit itaque adipisci!
</div>

<h3>display:block</h3>
<div>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. 
Rem ipsam dicta nam <span class="b">aliquam</span> 
<span class="b">eum</span> distinctio expedita delectus 
repellendus veniam dolor fugiat suscipit quas nihil libero 
architecto iusto odit itaque adipisci!
</div>

<h3>display:inline-block</h3>
<div>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. 
Rem ipsam dicta nam <span class="c">aliquam</span> 
<span class="c">eum</span> distinctio expedita delectus 
repellendus veniam dolor fugiat suscipit quas nihil libero 
architecto iusto odit itaque adipisci!
</div>

Previous & Next ๋ฒ„ํŠผ

<style>

a{
	text-decoration: none;
	padding:8px 16px;
	display:inline-block;	/* ๋„ˆ๋น„, ๋†’์ด ์ง€์ • */
}

a:hover{
	background-color: #ddd;
	color:black;
}

.prev{
	background-color: #f1f1f1;
	color:black;
	
	float:left;
}

.next{
	background-color: #4caf50;
	color:white;
	
	float:rigth;
}

</style>
<style>
.round{
	border-radius:50%;
}
</style>
<a href="#" class="prev">&laquo;Previous</a>
<a href="#" class="next">Next&raquo;</a>

<a href="#" class="prev round">&#8249;</a>
<a href="#" class="next round">&#8250;</a>

๋ ˆ์ด์•„์›ƒ(๋ฐฐ์น˜):[์ˆ˜ํ‰ ์ •๋ ฌ], ์ˆ˜์ง ์ •๋ ฌ

 

1.๋ธ”๋Ÿญ๋ชจ๋“œ(div)๋ฅผ ๊ฐ€๋กœ๋กœ ์ค‘์•™์— ๋ฐฐ์น˜ 

.center{
	width:50%;
	border:3px solid green;
	text-align:center;	/* ์š”์†Œ ๋‚ด๋ถ€์˜ ํ…์ŠคํŠธ๋ฅผ ์ค‘์•™์— ๋ฐฐ์น˜ */
	padding:10px;
	
	margin:0 auto; /* ์š”์†Œ ์ž์ฒด๋ฅผ ์ค‘์•™ ๋ฐฐ์น˜ */
}
<!-- .center>p>{Hello World!} -->
<div class="center">
	<p>Hello World!</p>
</div>

2. ์ธ๋ผ์ธ๋ชจ๋“œ(img)๋ฅผ ๊ฐ€๋กœ๋กœ ์ค‘์•™์— ๋ฐฐ์น˜

img{
	width:30%;
	
	display:block;
	margin:0 auto;	/* ์ธ๋ผ์ธ๋ชจ๋“œ์ด๊ธฐ ๋•Œ๋ฌธ์— ์ ์šฉ์ด ๋˜์ง€ ์•Š๋Š”๋‹ค. */
}
<img src="../images/paris.jpg" alt="paris">

3. ์šฐ์ธก์— ๋ฐฐ์น˜

1) position:absolute

2) float:right

#demo{
	width:50%;
	border:3px solid #73ad21;
	padding:3px;
	
	position:absolute;
	right:0;
	
	/* float:right; */
}
<div id="demo">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. 
Totam pariatur maxime voluptatibus nobis aliquid cupiditate 
possimus similique ducimus eligendi quis eaque corporis 
dignissimos debitis eum expedita repellat cumque inventore itaque.
</div>

๋ ˆ์ด์•„์›ƒ(๋ฐฐ์น˜):์ˆ˜ํ‰ ์ •๋ ฌ, [์ˆ˜์ง ์ •๋ ฌ]

<style>

.center{
	width:50%;
	border:3px solid green;
	margin: 0 auto;
	text-align:center;
	
	/*
	height:200px;
	*/
	
	/* 1. padding ์†์„ฑ ์‚ฌ์šฉ : top/bottom ์„ค์ •. ๋†’์ด ์„ค์ •X. */
	/* padding:70px 0 70px 0; */
	/* padding: 70px 0; */
	
	/* 2. ํŒ(ํŠธ๋ฆญ) : ๋†’์ด ์†์„ฑ๊ณผ line-height ์†์„ฑ๊ฐ’์„ ๋™์ผํ•˜๊ฒŒ ์„ค์ •ํ•˜๋ฉด -> ์ค‘์•™ */
	/* line-height : ๋ผ์ธ๊ณผ ๋ผ์ธ ๊ฐ„๊ฒฉ
	height:200px;
	line-height:200px;
	*/
	
	/* 3. transform ์†์„ฑ ์‚ฌ์šฉ : ๋ณ€ํ˜•์‹œํ‚ค๋Š” ์ž‘์—…  */
	height:200px;
	position:relative; /* ๊ฐ€์žฅ ๊ฐ€๊นŒ์šด ๊ธฐ์ค€์ด ๋˜๋Š” ๋ถ€๋ชจ ์š”์†Œ */
	
}

.center p{
	margin:0;
	padding:0;
	
	position:absolute;
	left:50%;
	top:50%;
	border:1px solid red;
	
	/* 3. */
	transform:translate(-50%, -50%);	/* ๋„ˆ๋น„, ๋†’์ด */
	-ms-transform:translate(-50%, -50%);	/* IE */
}

</style>
<div class="center">
	<p>Hello World!</p>
</div>

* -ms-transform : explorer

* ์ „ํ™˜(transition) ๋ณ€ํ™˜(transform) : https://velog.io/@wlrhkd49/CSS-%EC%86%8D%EC%84%B1-%EC%A0%84%ED%99%98-%EB%B3%80%ED%99%98

 

 

+ 4) flex

<style>
.center{
	width:400px;
	height:200px;
	
	border:3px solid green;
	margin: 0 auto;
	text-align:center;
	
	/* 4. flexbox๋ฅผ ์‚ฌ์šฉํ•ด์„œ ์‚ฌ๋ฌผ์„ ์ค‘์•™์— ๋ฐฐ์น˜ */
	/* IE10 ๋ฐ ์ด์ „ ๋ฒ„์ „์—์„œ๋Š” ์ง€์›๋˜์ง€ ์•Š๋Š”๋‹ค. */
	display:flex;	/* flex:๊ตด๊ณก์ง€๋‹ค. */
	justify-content: center;
	align-items: center;
}

.center p{
}
</style>

[ css 4๊ฐ€์ง€ ๊ฒฐํ•ฉ์ž(์—ฐ์‚ฐ์ž) ]

-  ์„ ํƒ์ž ๊ฐ„์˜ ๊ด€๊ณ„๋ฅผ ์„ค๋ช…ํ•˜๋Š” ๊ฒƒ 

   1) ์„ ํƒ์ž ์„ ํƒ์ž      : ํ›„์† ํฌํ•จ

   2) ์„ ํƒ์ž > ์„ ํƒ์ž  : ์ง๊ณ„์ž์‹๋งŒ

   3) ์„ ํƒ์ž + ์„ ํƒ์ž  : div + p = div์— ์ธ์ ‘ํ•œ p (๋ฐ”๋กœ ๋’ค)

   4) ์„ ํƒ์ž ~ ์„ ํƒ์ž  : div ~ p = div์— ๋”ฐ๋ผ์˜ค๋Š” ๋ชจ๋“  ํ˜•์ œ p


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

1. ์š”์†Œ์˜ ํŠน์ˆ˜ํ•œ ์ƒํƒœ๋ฅผ ์ •์˜ํ•  ๋•Œ ์‚ฌ์šฉํ•œ๋‹ค.

1) :link, :visited, :hover, :active

2) :focus

3) :first-child

4) :first-letter

5) :not(selector)

 

:checked, :empty, :first-of-type, :invalid, :in-range, 

:land(language), :last-child, :last-of-type, :nth-child(n), 

:nth-last-child(n), :only-child, :optional, 

:out-of-range, :read-only, :read-write, :required, 

:root, :target, :valid

 

[::์˜์‚ฌ์š”์†Œ] ex08

1. ์š”์†Œ์˜ ์ง€์ •๋œ ๋ถ€๋ถ„์— ์Šคํƒ€์ผ์„ ์ง€์ •ํ•  ๋•Œ ์‚ฌ์šฉํ•œ๋‹ค.

2. ์š”์†Œ์˜ ์ฒซ ๊ธ€์ž(::first-letter), ์š”์†Œ์˜ ์ฒซ ๋ผ์ธ(::first-line)

3. ์š”์†Œ ์ฝ˜ํ…์ธ  ๋’ค์— ์‚ฝ์ž… ::after

4. ์š”์†Œ ์ฝ˜ํ…์ธ  ์•ž์— ์‚ฝ์ž… ::before

5. ๋ชฉ๋ก ํ•ญ๋ชฉ์˜ ๋งˆ์ปค๋ฅผ ์„ ํƒ ::marker

6. ์‚ฌ์šฉ์ž์— ์˜ํ•ด์„œ ์„ ํƒ๋œ ์š”์†Œ์˜ ์ผ๋ถ€ ::selection

color, background, cursor, outline ์†์„ฑ ์ ์šฉ

 

1) ::after

2) ::first-letter

::first-line

::before, ::selection

 

<์˜์‚ฌ์š”์†Œ ์˜ˆ์ œ>

1. css counter : css ์ž๋™๋ฒˆํ˜ธ๋งค๊ธฐ๊ธฐ

1) section ์นด์šดํ„ฐ ๋ณ€์ˆ˜ ์„ ์–ธ == ์นด์šดํ„ฐ ์ƒ์„ฑ ๋˜๋Š” ์žฌ์„ค์ • + ์ดˆ๊ธฐํ™”(0)

counter-reset:section;

2) ์นด์šดํ„ฐ ๋ณ€์ˆ˜ 1์”ฉ ์ฆ๊ฐ€

counter-increment:section;

3) ์ƒ์„ฑ๋œ ์นด์šดํ„ฐ ์‚ฝ์ž….

๋‚ด์šฉ : counter() / counters() ์š”์†Œ์— ์นด์šดํŠธ ์ถ”๊ฐ€

content:counter(section);

<style>
body{
	counter-reset:section;
}

div::before{
	counter-increment:section;
	content:counter(section);
	
	background-color: black;
	color:white;
	padding: 1px 10px;
	margin-right:16px;
	border-radius:50%;
}
</style>
<div>Java</div> <div>Jsp</div> <div>Oracle</div> <div>JDBC</div> <div>html5</div> <div>css3</div>

*counter-reset : ์ž๋™ ๋ฒˆํ˜ธ


css ๋ถˆํˆฌ๋ช…๋„/ํˆฌ๋ช…๋„ ์ง€์ •

 

img == ์ธ๋ผ์ธ๋ชจ๋“œ

1) opacity ์†์„ฑ

2) rgb[a] == alpha ์ž์‹(ํ•˜์œ„)์š”์†Œ์— ํˆฌ๋ช…๋„๋Š” ์ƒ์†๋˜์ง€ ์•Š๋Š”๋‹ค.

img{
	width:170px;
	height:100px;
	
	opacity:0.5;
}

img:hover{
	opacity:0.8;
}
<img src="../images/img_forest.jpg" alt="">
<img src="../images/img_mountains.jpg" alt="">
<img src="../images/img_5terre.jpg" alt="">

ํƒ์ƒ‰๋ชจ๋“ฌ

1. ๋„ค๋น„๊ฒŒ์ด์…˜๋ฐ”(๋ฉ”๋‰ด๋ฐ”, ํƒ์ƒ‰ํ‘œ์‹œ์ค„)

์‚ฌ์šฉํ•˜๊ธฐ ์‰ฌ์šด ํƒ์ƒ‰ ๊ธฐ๋Šฅ - ๋ชจ๋“  ์›น ์‚ฌ์ดํŠธ์—์„œ ์ค‘์š”ํ•˜๋‹ค!

2. ul>li>a

<style>

body{
	transition:0.5s ease;
}

div#main{
	padding: 16px;
	
	transition:0.5s ease;
}

.sidenav{
	background-color: #111;
	position:fixed;	/* width:100% -> inline๋ชจ๋“œ์ฒ˜๋Ÿผ ๋‚ด์šฉ ๋„ˆ๋น„. */
	left:0;
	top:0;
	height:100%;
	
	/* ์ˆ˜์ง ๋„ค๋น„๊ฒŒ์ด์…˜ ๋ฉ”๋‰ด๋ฐ” : ์ˆจ๊น€ */
	width:0;
	overflow-x:hidden;
	
	transition:0.5s ease;
}
.sidenav a{
	display:block;
	color:#818181;
	padding:8px 8px 8px 32px;
	font-size:25px;
	text-decoration: none;
	
	transition:0.5s ease;
}
.sidenav a:hover{
	color:#f1f1f1;
}

</style>
<!-- #mySidenav.sidenav>a[href="#"]*5 -->
<div id="mySidenav" class="sidenav">
   <a href="#" class="closebtn">&times;</a>
   <a href="#">About</a>
   <a href="#">Services</a>
   <a href="#">Clients</a>
   <a href="#">Contact</a>
</div>

<!-- #main>h2>lorem3^p>lorem20^span -->
<div id="main">
   <h2>Lorem ipsum dolor.</h2>
   <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Minus inventore aspernatur laudantium neque autem esse ipsam nostrum repellat ad iure?</p>
   <span style="cursor: pointer;font-size: 30px;" onclick="openNav()">&#9776;</span>
</div>
<script>
function openNav(){
	// width:0; -> ๋„ˆ๋น„ ์„ค์ •
	// *** ๊ผญ ๋ฌธ์ž์—ด๋กœ ์ค˜์•ผํ•˜๋ฉฐ ๋‹จ์œ„๋„ ์ค˜์•ผํ•œ๋‹ค!! ***
	// *** margin-left -> marginLeft ***
	document.getElementById("mySidenav").style.width="250px";
	document.getElementById("main").style.marginLeft="250px";
	documnet.body.style.backgroundColor="rgba(0, 0, 0, 0.4)";
}

document.querySelector("#mySidenav>a.closebtn").onclick = function(){
	// alert("!!");
	// ์ด๋ฒคํŠธ ๋ฒ„๋ธ”๋ง
	document.getElementById("mySidenav").style.width="0";
	document.getElementById("main").style.marginLeft="0";
	documnet.body.style.backgroundColor="white";
}
</script>

๋“œ๋กญ๋‹ค์šด(dropdown) from_ex07.html : ํˆดํŒ (ํ•˜์œ„๋ฉ”๋‰ด)

.dropdown{
	position:relative;	/* *** */
	display:inline-block;	/* ์ด๋ ‡๊ฒŒ ์„ค์ •ํ•ด์•ผ ํ•œ๋‹ค.*** */
	
	left:300px;
}

.dropdown-content{
	display:none;
	
	position:absolute;
	
	background-color: #f9f9f9;
	min-width:160px;
	box-shadow:0 8px 16px 0 rgba(0, 0, 0, 0.2);
	padding:12px 16px;
	z-index:1;
	
}

/* ex07.html ํˆดํŒ */
.dropdown:hover .dropdown-content{
	display:block;
}
<div class="dropdown">
	<span>Mouse Over Me</span>
	<div class="dropdown-content">
		<p>Hello World!</p>
	</div>
</div>

<br>
js<br>
css<br>

* ๋ถ€๋ชจ relative ์ž์‹ absolute ์ค‘์š”!

 

ex2)

.dropdown{
	position:relative;
	display:inline-block;
}

.dropdown-content{
	display:none;
	
	position:absolute;
	right:0;
	
	background-color: #f9f9f9;
	min-width:160px;
	box-shadow:9px 8px 16px 0 rgba(0, 0, 0, 0.2);
	z-index:1;
}

.dropdown-content a{
	display:block;		/* ์—†์œผ๋ฉด ์˜†์œผ๋กœ ์ถœ๋ ฅ๋œ๋‹ค. */
	padding:12px 16px;
	text-decoration: none;
	color:block;
}

.dropdown-content a:hover{
	background-color: #f1f1f1;
}

.dropbtn{
	background-color: #4caf50;
	color:white;
	padding:16px;
	font-size:16px;
	border:none;
	cursor:pointer;
}

.dropdown:hover .dropdown-content{
	display:block;
}
<!-- .dropdown>button.dropbtn+.dropdown-content>a[href="#"]*3>{Link $} -->
<div class="dropdown" style="float: left">
   <button class="dropbtn">Left</button>
   <div class="dropdown-content" style="left:0">
      <a href="#">Link 1</a>
      <a href="#">Link 2</a>
      <a href="#">Link 3</a>
   </div>
</div>
<div class="dropdown" style="float:right">
   <button class="dropbtn">Right</button>
   <div class="dropdown-content">
      <a href="#">Link 1</a>
      <a href="#">Link 2</a>
      <a href="#">Link 3</a>
   </div>
</div>
  • ๋„ค์ด๋ฒ„ ๋ธ”๋Ÿฌ๊ทธ ๊ณต์œ ํ•˜๊ธฐ
  • ๋„ค์ด๋ฒ„ ๋ฐด๋“œ์— ๊ณต์œ ํ•˜๊ธฐ
  • ํŽ˜์ด์Šค๋ถ ๊ณต์œ ํ•˜๊ธฐ
  • ์นด์นด์˜ค์Šคํ† ๋ฆฌ ๊ณต์œ ํ•˜๊ธฐ