Online interview questions

Prepare interviews on Anything, AnyWhere

PHPSCOTS
PHPSCOTS
Blogger, Developer Views: 1063

Css interview questions

Top CSS interview Questions and answers

1. What is CSS?

CSS stands for Cascading Stylesheets which basically describes the layout of the HTML page. It defines the how the HTML page will be displayed. CSS is used to define style to the HTML page to make its design attractive and eye-catching.CSS saves a lot of work, one CSS file can control multiple web pages all at once.

2. How many ways can you insert CSS in HTML?

CSS can be inserted in the HTML page in the following three ways:

  • INLINE Style
  • INTERNAL Stylesheet
  • EXTERNAL Stylesheet

INLINE Style: CSS can be added to HTML page by giving style in HTML tags, this is called Inline CSS or Inline Style. This is the most simple method to add CSS. The style element is used.

Example: If we want to add style in our paragraph by using Inline CSS.

<p  style = “color : red; font-size : 24px;  font-family : verdana;  ” >

This is the Inline Style.

</p>

INTERNAL Stylesheet: Internal CSS can be added by using

tag inside the section. Internal Stylesheet is useful if the whole page has a unique style.

Example :

<head>

<style>

body  {

background-color: orange;

}

p {

color : red;

font-size : 24px;

font-family : verdana;

}

</style>

</head>

EXTERNAL Stylesheet: External CSS is useful is that case when we have a number of web pages and we can style the entire website in one CSS file. This stylesheet should not be written in the HTML code. External Stylesheet can be the included in the HTML code by giving reference to the stylesheet using the tag inside the head section. The external CSS file should have .css extension.

Example:

<head>

<link  rel=”stylesheet”   href=”stylesheet.css”   type=”text/css” />

</head>