מדריך מקיף לכל מאפייני CSS, הערכים והאפשרויות
PX, REM, EM, %, VW, VH ועוד.
ללמוד עוד ←Width, Height, Min ו-Max.
ללמוד עוד ←רווחים פנימיים וחיצוניים.
ללמוד עוד ←גופנים, גדלים, משקלים וטקסט.
ללמוד עוד ←HEX, RGB, HSL ו-Opacity.
ללמוד עוד ←Border, Radius ו-Shadow.
ללמוד עוד ←Block, Inline, Flex ו-Grid.
ללמוד עוד ←Static, Relative, Absolute ו-Fixed.
ללמוד עוד ←סידור אלמנטים בצורה גמישה.
ללמוד עוד ←בניית מערכות שורות ועמודות.
ללמוד עוד ←סיבוב, הגדלה והזזה.
ללמוד עוד ←אנימציות ומעברים.
ללמוד עוד ←Calc, Clamp, Min ו-Max.
ללמוד עוד ←Hover, Focus, Before ו-After.
ללמוד עוד ←התאמת האתר לכל המסכים.
ללמוד עוד ←יצירה ושימוש במשתנים.
ללמוד עוד ←Overflow, Cursor, Filter ועוד.
ללמוד עוד ←יחידות מידה קובעות את הגדלים, המרווחים והמיקומים של אלמנטים.
| יחידה | משמעות | דוגמה |
|---|---|---|
| px | פיקסלים | 100px |
| cm | סנטימטר | 5cm |
| mm | מילימטר | 20mm |
| in | אינץ' | 2in |
| pt | נקודות | 12pt |
| pc | פיקה | 2pc |
| יחידה | משמעות |
|---|---|
| % | יחס לאלמנט המכיל |
| em | יחס לגודל הגופן של האלמנט |
| rem | יחס לגודל הגופן של HTML |
| vw | אחוז מרוחב חלון הדפדפן |
| vh | אחוז מגובה חלון הדפדפן |
| svh | גובה חלון קטן |
| dvh | גובה חלון דינמי |
| vmin | הצד הקטן של החלון |
| vmax | הצד הגדול של החלון |
| ch | רוחב התו 0 |
| ex | גובה האות x |
.box {
width: 50%;
height: 100vh;
padding: 2rem;
font-size: 1.5rem;
}
שליטה ברוחב ובגובה של אלמנטים.
width: auto; width: 100px; width: 200px; width: 50%; width: 100vw; width: fit-content; width: max-content; width: min-content;
height: auto; height: 100px; height: 300px; height: 100%; height: 100vh;
min-width: 100px; max-width: 1200px; min-height: 100px; max-height: 800px;
margin: 10px; margin: 20px; margin: 10px 20px; margin-top: 10px; margin-right: 20px; margin-bottom: 30px; margin-left: 40px; margin: auto;
padding: 10px; padding: 20px; padding: 10px 20px; padding-top: 10px; padding-right: 20px; padding-bottom: 30px; padding-left: 40px;
font-size: 10px; font-size: 12px; font-size: 16px; font-size: 20px; font-size: 24px; font-size: 32px; font-size: 48px; font-size: 1rem; font-size: 2em; font-size: 150%; font-size: small; font-size: medium; font-size: large; font-size: x-large;
| ערך | משמעות |
|---|---|
| 100 | Thin |
| 200 | Extra Light |
| 300 | Light |
| 400 | Normal |
| 500 | Medium |
| 600 | Semi Bold |
| 700 | Bold |
| 800 | Extra Bold |
| 900 | Black |
text-align: left; text-align: right; text-align: center; text-align: justify; text-align: start; text-align: end;
text-decoration: none; text-decoration: underline; text-decoration: overline; text-decoration: line-through;
line-height: normal; line-height: 1; line-height: 1.5; line-height: 2; line-height: 24px;
color: red; color: blue; color: green; color: black; color: white; color: #ffffff; color: #000000; color: #ff0000; color: rgb(255, 0, 0); color: rgba(255, 0, 0, 0.5); color: hsl(120, 100%, 50%); color: hsla(120, 100%, 50%, 0.5);
הטווח הוא 0 עד 1.
opacity: 0; opacity: 0.1; opacity: 0.25; opacity: 0.5; opacity: 0.75; opacity: 1;
border: 1px solid red; border: 2px dashed blue; border: 3px dotted green; border: none; border-width: 1px; border-width: 2px; border-width: 5px; border-style: solid; border-style: dashed; border-style: dotted; border-style: double; border-style: groove; border-style: ridge; border-color: red;
border-radius: 0; border-radius: 5px; border-radius: 10px; border-radius: 20px; border-radius: 50%; border-radius: 100px;
box-shadow: 0 2px 5px black; box-shadow: 0 5px 15px rgba(0,0,0,.3); box-shadow: 0 10px 30px rgba(0,0,0,.5);
text-shadow: 2px 2px 5px black;
display: block; display: inline; display: inline-block; display: flex; display: inline-flex; display: grid; display: inline-grid; display: table; display: none; display: contents;
position: static; position: relative; position: absolute; position: fixed; position: sticky;
top: 0; right: 0; bottom: 0; left: 0; inset: 10px; inset: 10px 20px;
z-index: -1; z-index: 0; z-index: 1; z-index: 10; z-index: 100; z-index: 9999;
flex-direction: row; flex-direction: row-reverse; flex-direction: column; flex-direction: column-reverse;
justify-content: flex-start; justify-content: center; justify-content: flex-end; justify-content: space-between; justify-content: space-around; justify-content: space-evenly;
align-items: flex-start; align-items: center; align-items: flex-end; align-items: stretch; align-items: baseline;
flex-wrap: nowrap; flex-wrap: wrap; flex-wrap: wrap-reverse;
flex-grow: 0; flex-grow: 1; flex-shrink: 1; flex-shrink: 0; flex-basis: auto; flex-basis: 200px; gap: 10px; row-gap: 20px; column-gap: 15px;
display: grid; grid-template-columns: 1fr 1fr; grid-template-columns: repeat(3, 1fr); grid-template-columns: 200px 1fr; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); grid-template-rows: 100px 200px; gap: 10px; row-gap: 20px; column-gap: 15px;
grid-column: span 2; grid-row: span 2; grid-column: 1 / 3; grid-row: 1 / 3;
transform: scale(1); transform: scale(1.5); transform: scaleX(2); transform: scaleY(2);
transform: rotate(45deg); transform: rotateX(45deg); transform: rotateY(45deg);
transform: translateX(100px); transform: translateY(50px); transform: translate(20px, 30px);
transform: skew(10deg); transform: skewX(10deg); transform: skewY(10deg);
transition: all 0.3s ease; transition-duration: 1s; transition-delay: 0.5s; transition-timing-function: linear; transition-timing-function: ease; transition-timing-function: ease-in; transition-timing-function: ease-out; transition-timing-function: ease-in-out;
animation-name: move; animation-duration: 2s; animation-delay: 1s; animation-iteration-count: infinite; animation-direction: alternate; animation-fill-mode: forwards; animation-timing-function: linear;
@keyframes move {
0% {
transform: translateX(0);
}
50% {
transform: translateX(100px);
}
100% {
transform: translateX(0);
}
}
width: calc(100% - 50px); height: calc(100vh - 100px);
width: min(100%, 1200px);
width: max(50%, 400px);
font-size: clamp(16px, 3vw, 32px);
background: linear-gradient(red, blue); background: linear-gradient(90deg, red, blue);
background: radial-gradient(circle, red, blue);
filter: blur(5px); filter: brightness(1.2); filter: grayscale(100%); filter: contrast(150%); filter: saturate(200%);
a:hover {}
a:active {}
a:visited {}
input:focus {}
input:checked {}
input:disabled {}
input:enabled {}
li:first-child {}
li:last-child {}
li:nth-child(2) {}
li:nth-child(odd) {}
li:nth-child(even) {}
:not(.active) {}
:root {}
p::before {
content: "★";
}
p::after {
content: "!";
}
p::first-letter {}
p::first-line {}
::selection {}
::placeholder {}
/* Mobile */
@media (max-width: 600px) {
.container {
width: 100%;
}
}
/* Tablet */
@media (min-width: 601px)
and (max-width: 900px) {
.container {
width: 90%;
}
}
/* Desktop */
@media (min-width: 901px) {
.container {
width: 80%;
}
}
| מכשיר | רוחב לדוגמה |
|---|---|
| טלפון קטן | עד 480px |
| טלפון | עד 600px |
| טאבלט | 600px–900px |
| מחשב | 900px ומעלה |
| מסך רחב | 1200px ומעלה |
:root {
--primary: #648cff;
--secondary: #a16cff;
--spacing: 20px;
--radius: 10px;
}
.box {
color: var(--primary);
padding: var(--spacing);
border-radius: var(--radius);
}
overflow: visible; overflow: hidden; overflow: scroll; overflow: auto; overflow-x: hidden; overflow-y: auto;
cursor: auto; cursor: default; cursor: pointer; cursor: wait; cursor: move; cursor: not-allowed; cursor: grab; cursor: zoom-in;
object-fit: fill; object-fit: contain; object-fit: cover; object-fit: none; object-fit: scale-down;
visibility: visible; visibility: hidden; visibility: collapse;
white-space: normal; white-space: nowrap; white-space: pre; white-space: pre-wrap; white-space: pre-line;
list-style: none; list-style: disc; list-style: circle; list-style: square; list-style: decimal;
box-sizing: content-box; box-sizing: border-box;
pointer-events: auto; pointer-events: none;
user-select: auto; user-select: none; user-select: text; user-select: all;