Cascading Style Sheets
CSS or cascading style sheets is a design language. CSS describes how HTML looks on a web browser. CSS allows the web designer to separate the content of a webpage from its appearance. CSS allows the web designer to control the overall look of a webpage including the color, layout, and font. To put it simply, CSS makes the webpage presentable.
Before CSS, all presentation attributes were contained in the HTML markup. This wasn’t very efficient. Also, it limited the scope of the presentation. This meant that all the presentation attributes had to be explained and then repeated within the HTML.
ADVANTAGES OF CSS
- A CSS sheet can save you time because you can use the same sheet on multiple HTML pages
- CSS helps pages load faster because less code is being used
- CSS is easy to maintain
- CSS gives you a greater opportunity to customize your website since there are a greater number of attributes you can use compared to HTML
- CSS can be applied and optimized for multiple types of devices
- CSS is being used globally now since HTML attributes are being depreciated
DISADVANTAGES OF CSS
- CSS can be confusing because of the different levels
- CSS can work differently depending on what browser you use
- CSS data may not display correctly if the browser is outdated
- CSS is an open text-based system that can make you vulnerable
- CSS editing can impact HTML tags. Therefore, you may have to fix an HTML tag if you are editing CSS
The Three TYPES OF CSS
The Three types of CSS are inline, internal, and external CSS. Each type of CSS has a unique responsibility in a webpage design.
Inline CSS
- Applies the style to a single element that is present in the body section
Internal or Embedded CSS
- Applies the CSS to a single page
- Used when the entire page has one unique style for each element
- Includes the <style> tag in the <head> section
External CSS
- Used to apply styles to multiple pages
- A link needs to be added to the external CSS file
- Uses the .CSS extension