Chapter - 4
Cascading Style Sheets
Question-Answers
Q1. What are the different ways to insert stylesheets in the HTML document?
Ans. There are three ways to insert stylesheet in HTML document -
1. Inline
2. Internal
3. External
Q2. Differentiate between margin and padding property in CSS.
Ans.
Margin Padding
Margin is used to adjust the Padding adjusts the distance
distance between the border between the border of the
of the text and the border of text background and text
the browser window content.
Q3. How can you repeat the images horizontally and vertically at the background of the
text?
Ans. background-repeat : repeat-x is used to repeat the image horizontally in the background.
background-repeat : repeat-y is used to repeat the image vertically in the background.
Q4. What is the advantage of creating a class in CSS?
Ans. Whenever it is required to apply different styles to the same tag as it appears at different
places in the same HTML document, we create CSS classes. Example -
<html>
<head>
<style>
[Link]
{ color:red;
border:dotted
}
[Link]
{ color:blue;
border:dotted
}
</style>
</head>
<body>
<h1 class=one>First Section </h1>
<h1 class=two>Second Section </h1>
</body>
</html>