What Is CSS And Why We Use CSS
- What is CSS?
- CSS stands for Cascading Style Sheets
- CSS describes how HTML elements are to be displayed on screen, paper, or in other media
- CSS saves a lot of work. It can control the layout of multiple web pages all at once
- External stylesheets are stored in CSS files
- Why Use CSS?
- CSS is used to define styles for your web pages, including the design, layout and variations in display for different devices and screen sizes
- Some Common CSS Mistakes Should be Avoid
- Don't Use PX when it's not Needed
[ Bad ].class-name {
padding: 10px 0px;
}[ Good ].class-name {
padding: 10px 0;
}
- Use Shorthand properties
[ Bad ].class-name {
margin-top: 10px;
margin-bottom: 10px;
margin-left: 10px;
margin-right: 10px;
}[ Good ].class-name {
margin: 10px;
}
- Do Not Repeat Same Code
[ Bad ].class-name {
margin: 10px;
padding: 10px;
}
.other-class-name {
margin: 10px;
padding: 10px;
}[ Good ].class-name, .other-class-name {
margin: 10px;
padding: 10px;
}
- Use Color Code Instead Of Color Name
[ Bad ].class-name {
color: black
}[ Good ].class-name {
color: #000000
}
Thanks...

Comments
Post a Comment