Latest CSS Interview Question for Freshers

What is css

Cascading Style Sheets (CSS) is a rule based language that applies styling to HTML elements.

Why use CSS

We write CSS rules in html elements (, ), and modify properties of those elements such as color, background color, width, border thickness, font size, etc.

Current version of CSS ?

Current version of CSS is CSS3.

Is CSS case-sensitive ?

The CSS is not case-sensitive, but if an XHTML doctype is used, then CSS class names will be case-sensitive in some browsers.

Difference between margin and padding ?

padding is the area inside the border and margin is the area outside the border

Way of define a color in html ?

There is three way of defining a color in html
  • Hex
  • RGB
  • Name (i.e red)

Example

.colorname
{
Color:red;
Color:#ff0000;
Color:rgb(0,0,225);
}


Difference between visibility:hidden; and display:none; ?

  • Visibility:Hidden - It is not visible but takes up its original space.
  • Display:None - It is hidden and takes up absolutely no space as if it was never there.


How do you clear a floated element ?

A floated element is taken out of the document flow. To clear it you would need to do a clear:both or try overflow:auto on the containing div.


What are different ways to apply styles to a Web page ?

There are three way of apply css on web page
  • Inline css
  • Internal css
  • External css


What is a class and ID ?

A class is a style (i.e., a group of CSS attributes) that can be applied to one or more HTML elements.
An ID selector is a name assigned to a specific style. In turn, it can be associated with one HTML element with the assigned ID.


What is the difference between an ID selector and CLASS ?

An ID selector identifies and sets style to only one occurrence of an element, while CLASS can be attached to any number of elements.


What is Grouping ?

When more than one selector shares the same declaration, they may be grouped together via a comma-separated list;

Example

h1, h2, h3
{
background: #fff;
font-size:14px;
}


What is comment in css ?

Comment is nothing but it is a statement which is not display on browser window. It is useful to understand about particular code, which code is written for what purpose.


How to include comment in css ?

In CSS comments are include by using /* */ 


What are pseudo classes ?

Pseudo classes allow you to identify HTML elements on characteristics (as opposed to their name or attributes). The classes are specified using a colon to separate the element name and pseudo class. For example the :link and :visited pseudo classes for the HTML A element.

Example

a:link {font-color: red;}
a:visited {font-color: green;}
a:hover {font-color: yellow;}

p.footer {font-weight: bold;}


What are Child Selectors ?

A child selector is used when you want to match an element that is the child of another specific element. The parent and child selectors are separated by spaces.

Related

Interview Questions 4473201222044646554

Post a Comment

emo-but-icon

item