CSS Assignment
CSS Assignment
CSS (Cascading Style Sheets) is a styling language used to describe the presentation
and layout of web pages written in HTML or XML. It is used to add style, design, and
layout to a web page, including things like font styles, colours, spacing, and
positioning of various elements.
CSS is used to separate the presentation of a web page from its content, making it
easier to maintain and update a website. It also allows for greater control over the
appearance of a web page, allowing designers and developers to create visually
appealing and functional websites. Overall, CSS is an essential tool for creating
modern, responsive, and user-friendly web pages.
Q2. What are the different ways to bring CSS into an HTML file?
There are three primary ways to bring CSS into an HTML file:
1. External Style Sheets: In this method, the CSS code is stored in a separate file
with a .css extension, and then the HTML file links to this file using the <link>
tag in the head section of the HTML document.
2. Internal Style Sheets: In this method, the CSS code is written directly in the
head section of the HTML file, enclosed by the <style> tags.
3. Inline Styles: In this method, the CSS code is written directly within an HTML
element using the "style" attribute.
In CSS, specificity is the set of rules that determines which styles are applied to an
element when more than one rule could apply. The specificity of a selector is based
selectors taking precedence over less specific selectors. For example, an ID selector
has a higher specificity than a class selector, which in turn has a higher specificity
Specificity is important to understand because it can affect the way styles are
avoid confusion and ensure that styles are applied as intended, it is important to use