[Lab] Codecademy CSS 教學筆記 4

-- Sorting Your Friends --

1 / 8
What you'll be building




<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
<title></title>
</head>
<body>
<div class="friend" id="best_friend"><p>Arthur</p></div>
<div class="friend"><p>Batmanuel</p></div>
<div class="friend"><p>Captain Liberty</p></div>
<div class="friend"><p>The City</p></div>
<div class="friend"><p>Justice</p></div>
<div class="family"><p>Mom</p></div>
<div class="family"><p>Dad</p></div>
<div class="family"><p>Bro</p></div>
<div class="family"><p>Sis</p></div>
<div class="family"><p>Rex</p></div>
<div class="enemy"><p>Baron Violent</p></div>
<div class="enemy"><p>The Breadmaster</p></div>
<div class="enemy"><p>The Deadly Nose</p></div>
<div class="enemy"><p>Dinosaur Neil</p></div>
<div class="enemy" id="archnemesis"><p>Chairface</p></div>
</body>
</html>

--------CSS----------
div {
position: relative;
display: inline-block;
height: 100px;
width: 100px;
border-radius: 100%;
border: 2px solid black;
margin-left: 5px;
margin-top: 5px;
text-align: center;
}

div p {
position: relative;
margin-top: 40px;
font-size: 12px;
}

.friend {
border: 2px dashed green;
}

.family {
border: 2px dashed blue;
}

.enemy {
border: 2px dashed red;
}

#best_friend {
border: 4px solid #00C957;
}

#archnemesis {
border: 4px solid #cc0000;
}


2 / 8
Divide and conquer

3 / 8
Style those divs!
display: inline-block 
margin-left: 5px
圓圈
border-radius: 100%;
border: 2px solid black;

4 / 8
Classify

5 / 8
Use classes to add class

6 / 8
No ID, no entry
可同時擁有class跟id

7 / 8
Identify your IDs
Class跟id都有的時候,以id為主

8 / 8
You've done it!

留言

這個網誌中的熱門文章

[筆記] CRLF跟LF之區別 --- 隱形的 bug

[ML筆記] Batch Normalization

[筆記] 統計實習(1) SAS 基礎用法 (匯入資料並另存SAS新檔,SUBSTR,計算總和與平均,BMI)

[ML筆記] Ensemble - Bagging, Boosting & Stacking