Css Questions
Css Questions
Css Questions
- 19071221
QUESTIONS:-
Q1- What is a CSS selector?
Ans: -
E.G. all HTML elements with class="center" will be red and center-
aligned:
.center {
text-align: center;
color: red;
}
o CSS Universal Selector:- The universal selector (*) selects all HTML
elements on the page.
o E.G. The CSS rule below will affect every HTML element on the page:
*{
text-align: center;
color: blue;
}
o CSS Group Selector:- The grouping selector selects all the HTML elements
with the same style definitions.
o Look at the following CSS code (the h1, h2, and p elements have the
same style definitions:
E.G. group the selectors, to minimize the code.
h1, h2, p {
text-align: center;
color: red;
}
Ans: -
External style sheet is very useful as we write all the styling codes in a single file and
it can be used anywhere by just referring to the link of that external style sheet file.
So, if we do any changes in that external file, then the changes can also be observed
on the webpage. Thus we can say that it is very useful and it makes your work easy
while working on larger files.
Ans: -
Embedded style sheet gives us the privilege to define styles in one place in an HTML
document.
We can generate multiple classes using an embedded style sheet to use on multiple
tag types of a web page and also there is no extra downloading required for importing
the information.
function display()
{
document.writeln("Named Function");
}
display();
o Anonymous - These type of functions doesn't contain any name. They are
declared dynamically at runtime.
var display=function()
{
document.writeln("Anonymous Function");
}
display();
Var msg = "JavaScript is a case
sensitive language"; //Here, var should be used to declare a variable
function display()
{
document.writeln(msg); // It will not display the result.
}
display();