Enlist the various attributes of font?
They are:
- Font-style
- Font-variant
- Font-weight
- Font-size/line-height
- Font-family
- Caption
- Icon
Why does inserting a file make importation easy?
Importing allows the feature of combining external sheets to be placed in various sheets. Different sheets and files can be used to get a different function.
What is the use of a Class selector?
Class selectors are selectors that have a unique attribution to a specific style. Declaration of HTML with association and style can be done through this.
CSS Interview Questions
What is the difference between a Class selector and an ID selector?
ID selector only chooses a single element that differs from the other elements, while a class selector chooses an overall block. An element can sometimes have both a class and an ID. ID’s are unique but classes are not.
Can you add more than one declaration in CSS?
A semicolon can be used to add more than one declaration in CSS.
What are Pseudo-elements?
Pseudo-elements add several special effects to selectors. CSS applies various styles in HTML mark-up but sometimes, extra styling or mark-up in the document is not possible. This is when a feature known as pseudo-elements is used which is available in CSS. It permits extra styling or mark-up without disturbing or tampering with the actual document.
Advance CSS Interview Questions
How to overrule underlining Hyperlinks?
Underlining Hyperlinks can be overruled by using external style sheets and control statements.
Can CSS help in restoring default property value?
In CSS, due to a lack of default values, reverting back to old values is not possible. The property has to be re-declared in order to get back the default property.
List the kinds of Media types used in CSS?
Different media have different properties in CSS because they are case insensitive.
They are:
- Aural (for speech and sound synthesizers)
- Projection
- Handheld
- Screen
CSS Interview Questions
Compare Hexadecimal color codes with RGB values?
A color can be detailed in two ways:
- By characters i.e. hexadecimal coding of colors with a combination of letters and numbers preceded by #.
- By a mixture of blue, green, and red where the value of the color can be specified.
Compare Grouping and Nesting in CSS?
Grouping: In grouping, the code can be reduced by literally grouping selectors that have the same properties or values.
Nesting: In nesting, a selector is specified within another selector.
How can the dimensions of an element be defined?
Dimension properties of an element can be defined by:
- Height
- Max-height
- Max-width
- Min-height
- Min-width
- Width
Advance CSS Interview Questions
What is float property?
Using float property, an image can be moved along with the text to the right or to the left. Applying this property does not change the properties of the elements it is applied to.
How does the Z index function?
Sometimes, while positioning the elements of HTML using CSS, overlapping may occur. Z index helps in identifying and specifying the element that is overlapping. Z index’s default value is zero, but it can be a positive or a negative number.
Which of them is precedent: HTML procedures or CSS properties?
CSS properties are precedent over the HTML procedures. Even browsers with no CSS support, display the HTML attributes.
CSS Interview Questions
Define Inline style?
The Inline style is used on individual elements of HTML to add styling.
In CSS, how can comments be added?
/* and */ can be used to add comments in CSS.
What is Attribute Selector?
An attribute selector is a set of values, elements, and their parts.
Advance CSS Interview Questions
Define property?
Property is a style that helps in influencing the CSS language. They contain corresponding properties or values within them. Eg. Font, which has different styles like italic, bold, etc.
What is at-rule?
At-rule is a rule which is applicable on the whole sheet and not partly. It is preceded by @ followed by A-Z, a-z, or 0-9.
What is the difference between CSS and CSS3?
CSS does not have the concept of modules. CSS3 incorporates a new feature where it can group CSS codes into convenient modules. Modules ensure that all styles for a specific component will reside in one place.
CSS Interview Questions
Enlist the media types CSS allows?
The design and customization of documents are rendered by media. By applying media control over the external style sheets, they can be retrieved and used by loading it from the network.
Differentiate logical tags from physical tags?
- While physical tags are also referred to as presentational mark-up, logical tags are useless for appearances.
- Physical tags are newer versions while logical tags are old and concentrate on content.
Differentiate Style Sheet concept from HTML?
While HTML provides easy structure method, it lacks styling, unlike Style sheets. Moreover, style sheets have better browser capabilities and formatting options.
Advance CSS Interview Questions
Describe ‘ruleset’?
Ruleset : Selectors can be attached to other selectors to be identified by ruleset.
It has two parts:
- Selector, e.g. R and
- declaration {text-indent: 11pt}
Define Declaration block?
A catalog of directions within braces consisting of property, colon and value is called declaration block.
e.g.: [property 1: value 3]
What is contextual selector?
Selector used to select special occurrences of an element is called contextual selector. A space separates the individual selectors. Only the last element of the pattern is addressed in this kind of selector. For e.g.: TD P TEXT {color: blue}
CSS Interview Questions
Compare RGB values with Hexadecimal color codes ?
A color can be specified in two ways:
- A color is represented by 6 characters i.e. hexadecimal color coding. It is a combination of numbers and letters and is preceded by #. e.g.: g {color: #00cjfi}
- A color is represented by a mixture of red, green and blue. The value of a color can also be specified. 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.
Define Image sprites with context to CSS ?
When a set of images is collaborated into one image, it is known as ‘Image Sprites’. As the loading every image on a webpage consumes time, using image sprites lessens the time taken and gives information quickly.
CSS coding:
img.add { width: 60px; height: 55px; background: url (image.god) 0 0; }
In this case, only the part needed is used. The user can save substantial margin and time through this.
Compare Grouping and Nesting in CSS ?
Grouping: Selectors can be grouped having the same values of property and the code be reduced.
E.g. :
h1 {
color: blue;
}
h2 {
color: blue;
}
p {
color: blue;
}
It can be seen from the code that every element shares the same property. Rewriting can be avoided by writing each selector separated by a comma.
Nesting: Specifying a selector within a selector is called nesting.
P
{
color: red;
text-align: left;
}
.marked
{
background-color: blue;
}
.marked p
{
color: green;
}
Advance CSS Interview Questions
How can the dimension be defined of an element ?
Dimension properties can be defined by:
- Height
- Max-height
- Max-width
- Min-height
- Min-width
- Width
How does Z index function?
Overlapping may occur while using CSS for positioning HTML elements. Z index helps in specifying the overlapping element. It is a number which can be positive or negative, the default value being zero.
What is graceful degradation?
In case the component fails, it will continue to work properly in the presence of a graceful degradation. The latest browser application is used when a webpage is designed. As it is not available to everyone, there is a basic functionality, which enables its use to a wider audience. In case the image is unavailable for viewing, text is shown with the alt tag.
CSS Interview Questions
What is progressive enhancement?
It’s an alternative to graceful degradation, which concentrates on the matter of the web. The functionality is same, but it provides an extra edge to users having the latest bandwidth. It has been into prominent use recently with mobile internet connections expanding their base.
How can backward compatibility be designed in CSS?
HTML sheet methods is collaborated with CSS and used accordingly.
How can the gap under the image be removed?
As images being inline elements are treated same as texts, so there is a gap left, which can be removed by:
CSS
img { display: block ; }
Advance CSS Interview Questions
Why is @import only at the top?
@import is preferred only at the top, to avoid any overriding rules. Generally, ranking order is followed in most programming languages such as Java, Modula, etc. In C, the # is a prominent example of a @import being at the top.
Which among the following is more precedent: CSS properties or HTML procedures?
CSS is more precedent over HTML procedures. Browsers, which do not have CSS support, display HTML attributes.
What is Inline style?
The Inline style in a CSS is used to add up styling to individual HTML elements.
CSS Interview Questions
Define Attribute Selector ?
It is defined by a set of elements, value and its parts.
What is Alternate Style Sheet?
Alternate Style Sheets allows the user to select the style in which the page is displayed using the view>page style menu. Through Alternate Style Sheet, user can see a multiple version of the page on their needs and preferences.
Are quotes mandatory in URL’s?
Quotes are optional in URL’s, and it can be single or double.
Advance CSS Interview Questions
What is at-rule?
Rule, which is applicable in the entire sheet and not partly, is known as at-rule. It is preceded by @ followed by A-Z, a-z or 0-9.
How can CSS be cascaded to mix with user’s personal sheet?
Properties can be a set in recommended places and the document modified for CSS to mix with user’s personal sheet.
What happens if 100% width is used along with floats all across the page?
While making the float declaration, 1 pixel is added every time it is used in the form of the border, and even more float is allowed thereafter.
CSS Interview Questions