Css Interview Questions
Css Interview Questions
Css Interview Questions
com
CSS Interview Questions
What is CSS?
Every business is trying to make websites that are user engaging. An attractive website increases the
engagement time as the customer spends some time exploring it. Thus, every company is hiring developers
who can make that happen. If you are a CSS aspirant is applying for the post of CSS developer, make sure
you go through the smart compilation of these css interview questions that can help you achieve your
dream job.
Cascading style sheets or CSS is a web designing language simple for HTML elements. The application is
commonly known as XHTML. It is basically used to simplify the process and make the web page look
presentable.
Inline: term is used when the CSS code have attribute of HTML elements
External: separate CSS file is created in the workspace and later linking them in every web page that
is created
<head>
<link rel="text/css"
href="your_CSS_file_location"/>
</head>
Internal: the head element of the web page has internal CSS implemented in it
<head>
<style>
p{
color:lime;
background-color:black;
</style>
</head>
Q6. What is CSS Box Model and what are its elements?
The CSS box defines the design and the layout of elements of CSS. The several elements are:
div{
width: 300px;
border: 25px solid yellow;
padding: 25px;
margin: 25px;
}
The z-index helps specify the stack order of positioned elements that may overlap one another. The z-index
default value is zero, and can take on either a positive or negative number.
An element with a higher z-index is always stacked above than a lower index.
External: separate CSS file is created in the workspace and later linking them in every web page that is
created
<head>
</head>
Internal: the head element of the web page has internal CSS implemented in it
<head>
<style>
p{
color:lime;
background-color:black;
}
</style>
</head>
e.g.: rgb(r,g,b):
In this type the values can be in between the integers 0 and 255. rgb(r%,g%,b%): red, green and blue
percentage is shown.
Syntax
Selector: :pseudo-element {
property1 :value;
property2 :value;
A name preceded by a full stop is considered as a class selector in CSS. Selectors that are unique to a
specific style, are called CLASS selectors. Declaration of style and association with HTML can be made
through this. An ID identifies a single element whereas a class identifies more than one element.
They are:
Font-style
Font-variant
Font-weight
Font-size/line-height
Font-family
Caption
Icon
Basically it is not case sensitive but the class names are considered as case sensitive in HTML 4.01
nevertheless font families, URL’s of images, etc is. Only when XML declarations along with XHTML
DOCTYPE are being used on the page, CSS is case -sensitive.
Media is one of the most important features of CSS. The media renders the design and customization of
documents. By applying media control over the external style sheets, they can be retrieved and used by
loading it from the network. Some of the media types are:
There are several pointers that make local tags different from physical tags:
Physical Tags Local Tags
Physical tags are used to indicate how a particular logical tags are used to indicate by the visually
character is to be formatted impaired and put emphasis on the text.
Physical tags are also referred to as presentational
Logical tags are useless for appearances
mark-up
Physical tags are newer versions Logical tags are old and concentrate on content
While HTML provides easy structure method, it lacks styling, unlike Style sheets. Moreover, style sheets
have better browser capabilities and formatting options. CSS works better on bigger pages and as the pages
grow the benefits become more and more visible. HTML is basically for smaller pages. Due to modularity,
CSS has become popular it makes the process simple and webpages more presentable and is not meant for
HTML alone.
It is an instruction that tells browser on how to render a specific element on the HTML page. It consists of a
selector with a declaration block that follows. Rule set: Selectors can be attached to other selectors to be
identified by rule set.
CSS can’t fulfill turning completeness hence, it can never perform logical like ‘if/else’, for/while, etc,
or arithmetical tasks
One cannot read files using CSS
It cannot provide total control over document display and allows the contents of the page to come
through whatever the browser is used.
Ascending by selectors is not possible
Limitations of vertical control
No expressions as it is a text-based coding language
No column declaration
Pseudo-class not controlled by dynamic behavior
Rules, styles, targeting specific text not possible
CSS 1
CSS 2
CSS 2.1
CSS 3
CSS 4
These classes are used to define a special state of an element. You can use them for