h1 {
color: blue; 여기에서 color는 property, blue는 value라고 함.
text-transform: uppercase; property와 value를 입력했으면 ;(semicolon)으로 마무리하기.
}
p {
font-family: Arial;
}
.class {
color: grey;
}
#id {
font-size: 18px;
}
<h1 class="title green">I have two classes</h1>
.title {
text-transform: uppercase;
}
.green{
color: green'
}
<h1 class="red" id="only-once"></h1>
<h2 class="red"></h2>
.red {
color: red;
}
#only-once {
background-color: black;
}
<h1 id="red" class="blue"></h1>
h1 {
color: black !important;
}
#red {
color: red;
}
.class {
color: blue;
}
h1 {
color: green;
}
<h2 class="red">Hello, world!</h2>
h2.red {
color: red;
}
-->
<div class="title">
<p>I am inside of a div</p>
</div>
.title p{
font-family: cursive;
}
<h1>Hello, world!</h1>
<h2>Hello, our planet, the Earth</h2>
h1, h2 {
font-transform: uppercase;
}
body {
property: value;
}
h1 {
font-family: Georgia;
}
p {
font-family: Ariel;
}
p {
font-size: 22;
}
p {
font-weight: bold;
}
p {
text-align: left;
}
.caption {
color: black;
background-color: white;
}
#title {
color: red;
background-color: white;
opacity: 0.5;
}
.image {
background-image: url("https://avatars0.githubusercontent.com/u/52394741?s=280&v=4");
background-size: cover;
backgroudn-position: right;
height: 500px;
}
* {
box-sizing: border-box;
}
#banner {
height: 700px;
width: 100%;
}
.border {
border: 1px solid black; border 두께, 타입, 색깔 순
border-top:
border-right:
border-bottom:
border-left
border-radius: 3px; #border를 원형으로 만듦
}
#padding {
padding: 10px 10px 10px 10px; top right bottom left 시계 방향으로
padding: 10px 20px; top, bottom 10px | right, left 20px;
padding-top:
padding-right:
padding-bottom:
paddig-left:
}
#margin {
margin: 10px 10px 10px 10px; top right bottom left 시계 방향으로
margin: 10px 20px; top, bottom 10px | right, left 20px;
margin-top:
margin-right:
margin-bottom:
margin-left:
}
수평의 margin은 인접한 element의 margin이 더해진다.
수직의 margin은 인접한 element 중에 큰 쪽의 margin을 따른다
.center {
margin: 0 auto;
}
overflow property는 보이거나, 숨기거나, scroll를 설정함.
#main {
margin: 0 auto;
padding: 40px;
text-align: center;
width: 400px;
height: 1000px;
overflow: scroll;
}
.visibility {
visibility: hidden; # display: none과 다른 점은 display는 element를 완전히 없애서 공간도 사라지고, visibility: hidden은 공간은 남아 있음.
}