티스토리 뷰
* Custom Properties
- 색상이나 사이즈 등을 변수로 정의하여 사용한다.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Custom properties</title>
<!-- https://developer.mozilla.org/en-US/docs/Web/CSS/--* -->
<style>
:root {
--background-color: thistle;
--text-color: whitesmoke;
--base: 8px;
}
.first-list {
background-color: var(--background-color);
color: var(--text-color, red);
margin-left: var(--base);
}
.second-list {
background-color: var(--background-color);
color: var(--text-color, red);
margin-left: calc(var(--base) * 2);
}
@media screen and (max-width: 768px) {
:root {
--background-color: salmon;
--text-color: whitesmoke;
--base: 4px;
}
}
</style>
</head>
<body>
<ul class="first-list">
<li>Orange</li>
<li>Apple</li>
</ul>
<ul class="second-list">
<li>Korea</li>
<li>Japan</li>
<li>China</li>
</ul>
</body>
</html>
'CSS' 카테고리의 다른 글
🎁 CSS에서의 Box Model ? (0) | 2020.11.04 |
---|---|
💡 CSS 란 무엇일까? (0) | 2020.11.04 |
[HTML/CSS] Transition (0) | 2020.08.02 |
[HTML/CSS] background (0) | 2020.08.02 |
[HTML/CSS] box, text 정렬하기 ( margin, text-align, translate, text centering) (0) | 2020.08.02 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
TAG
- 프론트엔드개발자
- 공공데이터포털
- cssom
- CORS
- 생활코딩
- function
- nodejs
- CSS
- postman
- vue
- 프론트엔드면접
- baegofda
- vue3
- vue입문
- INPUT
- 공공데이터
- react
- JavaScript
- font-family
- 프론트엔드
- 프론트엔드회고
- 오물오물
- VanillaJS
- HTML
- inline
- 리액트
- axios
- 노드JS
- 개발자회고
- vue예제
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
글 보관함