how to write css code
Share
1,111,111 TRP = 11,111 USD
1,111,111 TRP = 11,111 USD
Reset Your New Password Now!
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this memory should be reported.
Please briefly explain why you feel this user should be reported.
1. Basic Syntax
CSS rules target HTML elements using selectors (e.g., h1 , .class , #id ). Declarations go inside {} :
selector { property: value; }
2. Common Properties
Text: color , font-size , text-align
Box Model: margin , padding , border
Layout: display , flexbox , grid
3. Example
body {
font-family: Arial;
margin: 0;
}
.header {
background: #333;
color: white;
padding: 1rem;
}
.button {
background: blue;
border: none;
border-radius: 4px;
}
4. Best Practices
Group selectors:
h1, h2 { color: red; }
Use shorthand:
margin: 10px 5px; /* top/bottom left/right */
Comments: /* Explain code */
5. Linking to HTML
Add CSS via:
Inline:
Internal: tag in
External: