5.
Using CSS in HTML
Q.1. Select the correct option.
i. What is the full form of CSS? [R]
a. Colour Style Sheet b. Creative Style Sheets
c. Cascading Style Sheet d. Cascading Style Script
ii. What is ‘green’ called in the given CSS statement? [U]
h1{color:green; text-align:center; }
a. property b. value
c. declaration d. selector
iii. What is the meaning of the following CSS code? [Ap]
h1 {color: "pink";}
a. All headings will be displayed in pink b. All headings will be
colour. displayed in default colour.
c. A heading defined by h1 will be d. All text in a paragraph will
displayed in pink colour. be displayed in pink colour.
iv. Which of the following correctly links to an external style sheet? [U]
a. <style type="text/css" b. <p style type="text/css"
href="style1.css"/> href="style1.css"/>
c. <link rel="stylesheet" d. Both a. and b.
type="text/css"href="style1.css"/>
v. What is the correct CSS statement to make the background colour of all [U]
paragraph elements blue?
Pg no. 1
5. Using CSS in HTML
a. b. p {background-color :
p {background-color : blue;}
#blue;}
c. all {background-color : blue;} d. all p {background-color :
#blue;}
Q.2. Answer the following question.
i. Observe the following CSS codes and answer the given questions. [Ap]
CSS
Code 1 CSS Code 2
a. Which type of selector is used in the given CSS codes?
Ans: CSS Code 1- ID selector
CSS Code 2- Class selector
b. Which CSS code is used to apply a style to only a single and unique
element in an HTML file?
Ans: CSS Code 1
c. Which code uses class names to find HTML elements for applying
formatting?
Ans: CSS Code 2
ii. What is the primary purpose of CSS in web development? How does it [U]
facilitate the styling of HTML pages?
Ans: CSS stands for cascading style sheet. It is used to style HTML
pages. It is the language used to describe the presentation and
formatting of web pages, such as colours, layout, background,
borders, fonts and so on.
Pg no. 2
5. Using CSS in HTML
iii. Reena has created a website containing more than ten web pages. She [Ap]
needs to use CSS for styling the web pages. Which type of style sheet
will be most appropriate for her and why?
Ans: An external style sheet allows Reena to define styles in a single file
and maintain consistency across all her web pages. This is
particularly beneficial for maintaining a uniform look and feel
throughout the entire website.
iv. Write the HTML code using internal stylesheet to get the following [An]
output.
Ans: <html>
<head>
<style>
p.uppercase {
text-transform: uppercase;
}
p.lowercase {
text-transform: lowercase;
}
p.capitalize {
text-transform: capitalize;
}
</style>
</head>
<body>
<p class=uppercase>My name is Rohan. </p>
<p class=lowercase> My name is Rohan. </p>
<p class=capitalize> My name is Rohan. </p>
Pg no. 3
5. Using CSS in HTML
</body></html>
v. Write the CSS code used to display the image ‘flower.jpg’ in the [Ap]
background of a web page as shown in the given image.
Ans: body
{
background-image: url(“flower.jpg” );
background-repeat: no-repeat;
background-position: right bottom;
}
Lab Activity
1. Create a web page containing information on “ Vasudhaiva Kutumbakam – The [Ap]
World is One Family!” with a heading, paragraph, and image. Style the web
page using an external stylesheet as given below.
a. Set a suitable background image for the entire web page. The image
should not be
b. repeated and appear on the right side of the web page.
c. Change the background colour of all <h1> headings to blue.
d. Change the font size of all paragraphs to 14 pixels and colour to blue-
green.
Pg no. 4
5. Using CSS in HTML
2. Create a webpage given below using HTML5 semantic tags.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Pg no. 5