Very Short Question and Answers - Introduction
Ans:
CSS stands for Cascading Style Sheets.
Ans:
The main purpose of CSS is to control the appearance (look and feel) of a webpage.
Ans:
HTML structures the content of the webpage, while CSS styles the content to control its appearance.
Ans:
A CSS rule consists of a selector, which selects the HTML element, and a declaration, which contains one or more properties and values.
Ans:
p { color: blue; font-size: 18px; }
Ans:
The three ways to apply CSS are Inline CSS, Internal CSS, and External CSS.
Ans:
Inline CSS is CSS written inside an HTML tag using the style attribute, for example:
<p style="color:red;">Hello</p>.
Ans:
Internal CSS is written inside the <style> tag within the <head> section of the HTML document.
Ans:
By using the <link> tag with rel="stylesheet" and href="filename.css", for example:
<link rel="stylesheet" href="style.css" />
Ans:
External CSS is most commonly used in real websites.
Ans:
CSS saves time by allowing styles to be written once and applied to many pages, and it makes webpages more attractive by adding colors, backgrounds, borders, fonts, and better layouts.
Ans:
CSS can adjust layouts for different devices like mobiles, tablets, and laptops using responsive CSS techniques such as media queries.
Ans:
Because styling is moved from HTML to CSS files, the HTML becomes smaller, reducing page size and thus loading faster.
Ans:
Different browsers like Chrome, Firefox, and Edge may display CSS styles slightly differently, causing browser compatibility issues.
Ans:
Because as the website grows big, managing many style rules becomes complex and hard to maintain.
Ans:
No, CSS is public and anyone can view the CSS code using browser tools like Inspect Element.
Ans:
Beginners may find it difficult to understand selectors, specificity rules, and inheritance, especially when multiple styles affect the same element.
Ans:
CSS is called 'Cascading' because the browser follows an order of priority (cascade) when applying styles from different sources.
Ans:
The priority order is: Inline CSS (highest), Internal CSS, External CSS, and then browser default styles (lowest).
Ans:
The CSS rule with the highest priority according to the cascade order will take precedence, typically Inline CSS over Internal, and Internal over External CSS.