CSS Examples
700 க்கும் மேற்பட்ட எடுத்துக்காட்டுகளிலிருந்து கற்றுக்கொள்ளுங்கள்! எங்கள் எடிட்டருடன், நீங்கள் CSS ஐத் திருத்தலாம் மற்றும் முடிவைக் காண பொத்தானைக் கிளிக் செய்யலாம்.
எவ்வாறு பயன்படுத்துவது:
ஒவ்வொரு பிரிவிலும் உள்ள "Try it Yourself" பொத்தானைக் கிளிக் செய்வதன் மூலம் எடுத்துக்காட்டுகளை நேரடியாக உங்கள் உலாவியில் இயக்கலாம்.
CSS Basics
CSS Syntax & Selectors
Colors & Backgrounds
Box Model & Layout
CSS Syntax Example
Basic CSS Syntax:
selector {
property: value;
property: value;
}
Practical Example:
h1 {
color: blue;
text-align: center;
font-size: 32px;
}
p {
color: #333;
line-height: 1.6;
margin-bottom: 20px;
}
CSS Colors Example
Color Names:
h1 {
color: red;
}
div {
background-color: blue;
}
p {
color: green;
}
Hex Colors:
.primary {
color: #FF5733;
}
.secondary {
background-color: #33FF57;
}
.dark {
color: #333333;
}
RGB & RGBA:
.rgb-example {
color: rgb(255, 0, 0);
}
.rgba-example {
background-color: rgba(0, 0, 255, 0.5);
}
CSS Typography & Text
Text & Fonts
Links & Lists
Icons & Images
CSS Text Example
Text Alignment:
.left-align {
text-align: left;
}
.center-align {
text-align: center;
}
.right-align {
text-align: right;
}
.justify {
text-align: justify;
}
Text Decoration:
.underline {
text-decoration: underline;
}
.overline {
text-decoration: overline;
}
.line-through {
text-decoration: line-through;
}
.none {
text-decoration: none;
}
Text Transform:
.uppercase {
text-transform: uppercase;
}
.lowercase {
text-transform: lowercase;
}
.capitalize {
text-transform: capitalize;
}
CSS Layout & Positioning
Display & Position
Modern Layouts
Alignment & Spacing
CSS Flexbox Example
Basic Flex Container:
.flex-container {
display: flex;
justify-content: center;
align-items: center;
gap: 20px;
}
.flex-item {
flex: 1;
padding: 20px;
background: #f0f0f0;
}
Flex Direction:
.row {
display: flex;
flex-direction: row;
}
.column {
display: flex;
flex-direction: column;
}
.row-reverse {
display: flex;
flex-direction: row-reverse;
}
.column-reverse {
display: flex;
flex-direction: column-reverse;
}
Flex Wrap:
.nowrap {
display: flex;
flex-wrap: nowrap;
}
.wrap {
display: flex;
flex-wrap: wrap;
}
.wrap-reverse {
display: flex;
flex-wrap: wrap-reverse;
}
CSS Grid Example
Basic Grid:
.grid-container {
display: grid;
grid-template-columns: 1fr 1fr 1fr;
gap: 20px;
}
.grid-item {
padding: 20px;
background: #f0f0f0;
}
Grid Template Areas:
.container {
display: grid;
grid-template-areas:
"header header header"
"sidebar content content"
"footer footer footer";
gap: 10px;
}
.header { grid-area: header; }
.sidebar { grid-area: sidebar; }
.content { grid-area: content; }
.footer { grid-area: footer; }
Responsive Grid:
.responsive-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 15px;
}
CSS Advanced Features
Animations & Transitions
Effects & Filters
Advanced Features
CSS Transitions Example
Basic Transition:
.button {
background-color: blue;
color: white;
padding: 10px 20px;
transition: background-color 0.3s ease;
}
.button:hover {
background-color: red;
}
Multiple Properties:
.box {
width: 100px;
height: 100px;
background: blue;
transition: all 0.5s ease-in-out;
}
.box:hover {
width: 200px;
height: 200px;
background: red;
transform: rotate(45deg);
}
Transition Delay:
.delayed {
transition: opacity 0.3s ease 0.5s;
}
.delayed:hover {
opacity: 0.5;
}
CSS Media Queries Example
Mobile First:
/* Mobile styles */
.container {
padding: 10px;
}
/* Tablet */
@media (min-width: 768px) {
.container {
padding: 20px;
}
}
/* Desktop */
@media (min-width: 1024px) {
.container {
padding: 30px;
}
}
Responsive Grid:
.grid {
display: grid;
grid-template-columns: 1fr;
gap: 10px;
}
@media (min-width: 768px) {
.grid {
grid-template-columns: repeat(2, 1fr);
}
}
@media (min-width: 1024px) {
.grid {
grid-template-columns: repeat(4, 1fr);
}
}
Orientation:
/* Portrait */
@media (orientation: portrait) {
.container {
flex-direction: column;
}
}
/* Landscape */
@media (orientation: landscape) {
.container {
flex-direction: row;
}
}
Exercise
பயிற்சி:
பின்வரும் CSS குறியீட்டில் என்ன தவறு?
div {
color: blue
font-size: 16px;
margin: 10px
}