logo

Very Short Question and Answers - Introduction


Q 1.
What does CSS stand for?

Ans:

CSS stands for Cascading Style Sheets.

Q 2.
What is the main purpose of CSS?

Ans:

The main purpose of CSS is to control the appearance (look and feel) of a webpage.

Q 3.
How do HTML and CSS work together?

Ans:

HTML structures the content of the webpage, while CSS styles the content to control its appearance.

Q 4.
What are the two parts of a CSS rule?

Ans:

A CSS rule consists of a selector, which selects the HTML element, and a declaration, which contains one or more properties and values.

Q 5.
Give an example of a CSS rule to change the color and font size of all paragraph elements.

Ans:

p { color: blue; font-size: 18px; }
Q 6.
Name the three ways to apply CSS in an HTML page.

Ans:

The three ways to apply CSS are Inline CSS, Internal CSS, and External CSS.

Q 7.
What is Inline CSS and how is it written?

Ans:

Inline CSS is CSS written inside an HTML tag using the style attribute, for example:

<p style="color:red;">Hello</p>.
Q 8.
Where is Internal CSS written in an HTML document?

Ans:

Internal CSS is written inside the <style> tag within the <head> section of the HTML document.

Q 9.
How do you link an External CSS file to an HTML page?

Ans:

By using the <link> tag with rel="stylesheet" and href="filename.css", for example:

<link rel="stylesheet" href="style.css" />
Q 10.
Which CSS application method is most commonly used in real websites?

Ans:

External CSS is most commonly used in real websites.

Q 11.
List two advantages of using CSS.

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.

Q 12.
How does CSS help in making websites device-friendly?

Ans:

CSS can adjust layouts for different devices like mobiles, tablets, and laptops using responsive CSS techniques such as media queries.

Q 13.
Why does using CSS lead to faster page loading?

Ans:

Because styling is moved from HTML to CSS files, the HTML becomes smaller, reducing page size and thus loading faster.

Q 14.
What is one major disadvantage of CSS related to browser compatibility?

Ans:

Different browsers like Chrome, Firefox, and Edge may display CSS styles slightly differently, causing browser compatibility issues.

Q 15.
Why can managing CSS become difficult in large projects?

Ans:

Because as the website grows big, managing many style rules becomes complex and hard to maintain.

Q 16.
Can CSS code be kept private and secure from users?

Ans:

No, CSS is public and anyone can view the CSS code using browser tools like Inspect Element.

Q 17.
Why might beginners find CSS difficult to learn?

Ans:

Beginners may find it difficult to understand selectors, specificity rules, and inheritance, especially when multiple styles affect the same element.

Q 18.
Explain why CSS is called 'Cascading' Style Sheets.

Ans:

CSS is called 'Cascading' because the browser follows an order of priority (cascade) when applying styles from different sources.

Q 19.
What is the priority order followed by browsers when applying CSS styles?

Ans:

The priority order is: Inline CSS (highest), Internal CSS, External CSS, and then browser default styles (lowest).

Q 20.
If conflicting CSS rules apply to the same element, which CSS rule will take precedence?

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.